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 105
105
import org .hibernate .mapping .SimpleValue ;
106
106
import org .hibernate .mapping .SingleTableSubclass ;
107
107
import org .hibernate .mapping .Subclass ;
108
+ import org .hibernate .mapping .SyntheticProperty ;
108
109
import org .hibernate .mapping .Table ;
109
110
import org .hibernate .mapping .TableOwner ;
110
111
import org .hibernate .mapping .UnionSubclass ;
@@ -550,7 +551,7 @@ private Component createMapperProperty(
550
551
propertyAccessor ,
551
552
isIdClass
552
553
);
553
- final Property mapperProperty = new Property ();
554
+ final Property mapperProperty = new SyntheticProperty ();
554
555
mapperProperty .setName ( NavigablePath .IDENTIFIER_MAPPER_PROPERTY );
555
556
mapperProperty .setUpdateable ( false );
556
557
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