Add h8-preview module: hibernate-demo suite against Hibernate 8.0.0.Beta3 and Jakarta Persistence 4.0.0-M7
Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gth99spB1CzQmBFofXmU4Z
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.query.NativeQuery;
|
||||
import org.hibernate.transform.Transformers;
|
||||
|
||||
/** Not built. Result transformers were the classic way to map a native query onto a DTO. */
|
||||
class UsesTransformers {
|
||||
|
||||
public static class Dto {
|
||||
public Integer id;
|
||||
}
|
||||
|
||||
Object rows(Session s) {
|
||||
return s.createNativeQuery("select 1 as id", Object.class).unwrap(NativeQuery.class)
|
||||
.setResultTransformer(Transformers.aliasToBean(Dto.class)).list();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user