Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
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;
Expand Down Expand Up @@ -558,7 +559,7 @@ private Component createMapperProperty(
propertyAccessor,
isIdClass
);
final Property mapperProperty = new Property();
final Property mapperProperty = new SyntheticProperty();
mapperProperty.setName( NavigablePath.IDENTIFIER_MAPPER_PROPERTY );
mapperProperty.setUpdateable( false );
mapperProperty.setInsertable( false );
Expand Down
Original file line number Diff line number Diff line change
@@ -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