HHH-18841 Create `_identifierMapper` as a synthetic attribute
This commit is contained in:
parent
0b856f531d
commit
7cdab319fb
|
@ -94,6 +94,7 @@ import org.hibernate.mapping.RootClass;
|
|||
import org.hibernate.mapping.SimpleValue;
|
||||
import org.hibernate.mapping.SingleTableSubclass;
|
||||
import org.hibernate.mapping.Subclass;
|
||||
import org.hibernate.mapping.SyntheticProperty;
|
||||
import org.hibernate.mapping.Table;
|
||||
import org.hibernate.mapping.TableOwner;
|
||||
import org.hibernate.mapping.UnionSubclass;
|
||||
|
@ -566,7 +567,7 @@ public class EntityBinder {
|
|||
propertyAccessor,
|
||||
isIdClass
|
||||
);
|
||||
final Property mapperProperty = new Property();
|
||||
final Property mapperProperty = new SyntheticProperty();
|
||||
mapperProperty.setName( NavigablePath.IDENTIFIER_MAPPER_PROPERTY );
|
||||
mapperProperty.setUpdateable( false );
|
||||
mapperProperty.setInsertable( false );
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.orm.test.id.idClass;
|
||||
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.DomainModelScope;
|
||||
import org.hibernate.testing.orm.junit.Jira;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@DomainModel(
|
||||
annotatedClasses = MyEntity.class
|
||||
)
|
||||
@SessionFactory
|
||||
public class IdClassSyntheticAttributesTest {
|
||||
|
||||
@Jira("https://hibernate.atlassian.net/browse/HHH-18841")
|
||||
@Test
|
||||
public void test(DomainModelScope scope) {
|
||||
final PersistentClass entityBinding = scope.getDomainModel().getEntityBinding(MyEntity.class.getName());
|
||||
assertThat(entityBinding.getProperties()).hasSize(2)
|
||||
.anySatisfy(p -> {
|
||||
assertThat(p.isSynthetic()).isTrue();
|
||||
assertThat(p.getName()).isEqualTo("_identifierMapper");
|
||||
})
|
||||
.anySatisfy(p -> {
|
||||
assertThat(p.isSynthetic()).isFalse();
|
||||
assertThat(p.getName()).isEqualTo("notes");
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue