HHH-18662 Add test for issue
This commit is contained in:
parent
c3d7e5f0b5
commit
1327f002cd
|
@ -18,6 +18,7 @@ import org.hibernate.testing.orm.junit.ServiceRegistry;
|
|||
import org.hibernate.testing.orm.junit.ServiceRegistryScope;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
import jakarta.persistence.Transient;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
@ -44,13 +45,13 @@ public class CompletePartialTests {
|
|||
final ClassDetailsRegistry classDetailsRegistry = sourceModelBuildingContext.getClassDetailsRegistry();
|
||||
final ClassDetails classDetails = classDetailsRegistry.getClassDetails( Thing.class.getName() );
|
||||
|
||||
// NOTE : `#createBuildingContext` applies `XmlProcessor`, so `@Transient` handling is applied...
|
||||
// NOTE : `#createBuildingContext` applies `XmlProcessor`
|
||||
|
||||
assertThat( classDetails.getFields() ).hasSize( 3 );
|
||||
classDetails.forEachField( (i, fieldDetails) -> {
|
||||
assertThat( fieldDetails.isPersistable() ).isTrue();
|
||||
final boolean expectTransient = fieldDetails.getName().equals( "somethingElse" );
|
||||
assertThat( fieldDetails.hasDirectAnnotationUsage( Transient.class ) ).isEqualTo( expectTransient );
|
||||
assertThat( fieldDetails.hasDirectAnnotationUsage( Transient.class ) ).isFalse();
|
||||
|
||||
} );
|
||||
}
|
||||
|
||||
|
@ -60,6 +61,6 @@ public class CompletePartialTests {
|
|||
public void testBootModel(DomainModelScope domainModelScope) {
|
||||
final PersistentClass entityBinding = domainModelScope.getEntityBinding( Thing.class );
|
||||
assertThat( entityBinding.getIdentifierProperty().getName() ).isEqualTo( "id" );
|
||||
assertThat( entityBinding.getProperties().stream().map( Property::getName ) ).containsOnly( "name" );
|
||||
assertThat( entityBinding.getProperties().stream().map( Property::getName ) ).contains( "name" ).contains( "somethingElse" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<attributes>
|
||||
<id name="name"/>
|
||||
<id name="number"/>
|
||||
<transient name="addresses"/>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
Loading…
Reference in New Issue