File tree Expand file tree Collapse file tree 3 files changed +55
-0
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/metamodel Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 28
28
Person .class ,
29
29
Measurement .class ,
30
30
Height .class ,
31
+ WeightClass .class ,
32
+ Weight .class ,
31
33
} )
32
34
public class EmbeddableMetaModelTest {
33
35
@ Test
@@ -62,4 +64,18 @@ public void test(EntityManagerFactoryScope scope) {
62
64
assertNotNull ( Measurement_ .unit );
63
65
} );
64
66
}
67
+
68
+ @ Test
69
+ @ Jira ( "https://hibernate.atlassian.net/browse/HHH-18819" )
70
+ public void testIdClass (EntityManagerFactoryScope scope ) {
71
+ scope .inTransaction ( entityManager -> {
72
+ final EmbeddableDomainType <Weight > embeddable = (EmbeddableDomainType <Weight >) entityManager .getMetamodel ()
73
+ .embeddable ( Weight .class );
74
+ assertNotNull ( embeddable .getSuperType () );
75
+ assertEquals ( MAPPED_SUPERCLASS , embeddable .getSuperType ().getPersistenceType () );
76
+ assertEquals ( Measurement .class , embeddable .getSuperType ().getJavaType () );
77
+ assertNotNull ( Weight_ .weight );
78
+ assertNotNull ( Measurement_ .unit );
79
+ } );
80
+ }
65
81
}
Original file line number Diff line number Diff line change
1
+ /*
2
+ * SPDX-License-Identifier: LGPL-2.1-or-later
3
+ * Copyright Red Hat Inc. and Hibernate Authors
4
+ */
5
+ package org .hibernate .orm .test .metamodel ;
6
+
7
+ import jakarta .persistence .Embeddable ;
8
+
9
+ /**
10
+ * @author Marco Belladelli
11
+ */
12
+ @ Embeddable
13
+ public class Weight extends Measurement {
14
+ private float weight ;
15
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * SPDX-License-Identifier: LGPL-2.1-or-later
3
+ * Copyright Red Hat Inc. and Hibernate Authors
4
+ */
5
+ package org .hibernate .orm .test .metamodel ;
6
+
7
+ import jakarta .persistence .Entity ;
8
+ import jakarta .persistence .Id ;
9
+ import jakarta .persistence .IdClass ;
10
+
11
+ /**
12
+ * @author Marco Belladelli
13
+ */
14
+ @ Entity
15
+ @ IdClass (Weight .class )
16
+ public class WeightClass {
17
+ @ Id
18
+ private String unit ;
19
+
20
+ @ Id
21
+ private float weight ;
22
+
23
+ private String description ;
24
+ }
You can’t perform that action at this time.
0 commit comments