File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/query/hql Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public void testRecordInstantiationWithoutAlias(SessionFactoryScope scope) {
55
55
}
56
56
57
57
@ Test
58
- public void testSqlRecordInstantiationWithoutAlias (SessionFactoryScope scope ) {
58
+ public void testSqlRecordInstantiationWithoutMapping (SessionFactoryScope scope ) {
59
59
scope .inTransaction (
60
60
session -> {
61
61
session .persist (new Thing (1L , "thing" ));
@@ -69,6 +69,23 @@ public void testSqlRecordInstantiationWithoutAlias(SessionFactoryScope scope) {
69
69
);
70
70
}
71
71
72
+ @ Test
73
+ public void testSqlRecordInstantiationWithMapping (SessionFactoryScope scope ) {
74
+ scope .inTransaction (
75
+ session -> {
76
+ session .persist (new Thing (1L , "thing" ));
77
+ Record result = (Record ) session .createNativeQuery ( "select id, upper(name) as name from thingy_table" , Record .class )
78
+ .addScalar ("id" , Long .class )
79
+ .addScalar ("name" , String .class )
80
+ .addSynchronizedEntityClass (Thing .class )
81
+ .getSingleResult ();
82
+ assertEquals ( result .id (), 1L );
83
+ assertEquals ( result .name (), "THING" );
84
+ session .getTransaction ().setRollbackOnly ();
85
+ }
86
+ );
87
+ }
88
+
72
89
@ Test
73
90
public void testTupleInstantiationWithAlias (SessionFactoryScope scope ) {
74
91
scope .inTransaction (
You can’t perform that action at this time.
0 commit comments