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 2626 Person .class ,
2727 Measurement .class ,
2828 Height .class ,
29+ WeightClass .class ,
30+ Weight .class ,
2931} )
3032public class EmbeddableMetaModelTest {
3133 @ Test
@@ -60,4 +62,18 @@ public void test(EntityManagerFactoryScope scope) {
6062 assertNotNull ( Measurement_ .unit );
6163 } );
6264 }
65+
66+ @ Test
67+ @ Jira ( "https://hibernate.atlassian.net/browse/HHH-18819" )
68+ public void testIdClass (EntityManagerFactoryScope scope ) {
69+ scope .inTransaction ( entityManager -> {
70+ final EmbeddableDomainType <Weight > embeddable = (EmbeddableDomainType <Weight >) entityManager .getMetamodel ()
71+ .embeddable ( Weight .class );
72+ assertNotNull ( embeddable .getSuperType () );
73+ assertEquals ( MAPPED_SUPERCLASS , embeddable .getSuperType ().getPersistenceType () );
74+ assertEquals ( Measurement .class , embeddable .getSuperType ().getJavaType () );
75+ assertNotNull ( Weight_ .weight );
76+ assertNotNull ( Measurement_ .unit );
77+ } );
78+ }
6379}
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