File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
main/java/org/hibernate/boot/model/internal
test/java/org/hibernate/orm/test/id/idClass Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 9494import org .hibernate .mapping .SimpleValue ;
9595import org .hibernate .mapping .SingleTableSubclass ;
9696import org .hibernate .mapping .Subclass ;
97+ import org .hibernate .mapping .SyntheticProperty ;
9798import org .hibernate .mapping .Table ;
9899import org .hibernate .mapping .TableOwner ;
99100import org .hibernate .mapping .UnionSubclass ;
@@ -566,7 +567,7 @@ private Component createMapperProperty(
566567 propertyAccessor ,
567568 isIdClass
568569 );
569- final Property mapperProperty = new Property ();
570+ final Property mapperProperty = new SyntheticProperty ();
570571 mapperProperty .setName ( NavigablePath .IDENTIFIER_MAPPER_PROPERTY );
571572 mapperProperty .setUpdateable ( false );
572573 mapperProperty .setInsertable ( false );
Original file line number Diff line number Diff line change 1+ /*
2+ * Hibernate, Relational Persistence for Idiomatic Java
3+ *
4+ * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5+ * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
6+ */
7+ package org .hibernate .orm .test .id .idClass ;
8+
9+ import org .hibernate .mapping .PersistentClass ;
10+ import org .hibernate .testing .orm .junit .DomainModel ;
11+ import org .hibernate .testing .orm .junit .DomainModelScope ;
12+ import org .hibernate .testing .orm .junit .Jira ;
13+ import org .hibernate .testing .orm .junit .SessionFactory ;
14+ import org .junit .jupiter .api .Test ;
15+
16+ import static org .assertj .core .api .Assertions .assertThat ;
17+
18+ @ DomainModel (
19+ annotatedClasses = MyEntity .class
20+ )
21+ @ SessionFactory
22+ public class IdClassSyntheticAttributesTest {
23+
24+ @ Jira ("https://hibernate.atlassian.net/browse/HHH-18841" )
25+ @ Test
26+ public void test (DomainModelScope scope ) {
27+ final PersistentClass entityBinding = scope .getDomainModel ().getEntityBinding (MyEntity .class .getName ());
28+ assertThat (entityBinding .getProperties ()).hasSize (2 )
29+ .anySatisfy (p -> {
30+ assertThat (p .isSynthetic ()).isTrue ();
31+ assertThat (p .getName ()).isEqualTo ("_identifierMapper" );
32+ })
33+ .anySatisfy (p -> {
34+ assertThat (p .isSynthetic ()).isFalse ();
35+ assertThat (p .getName ()).isEqualTo ("notes" );
36+ });
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments