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 2828 Person .class ,
2929 Measurement .class ,
3030 Height .class ,
31+ WeightClass .class ,
32+ Weight .class ,
3133} )
3234public class EmbeddableMetaModelTest {
3335 @ Test
@@ -62,4 +64,18 @@ public void test(EntityManagerFactoryScope scope) {
6264 assertNotNull ( Measurement_ .unit );
6365 } );
6466 }
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+ }
6581}
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