diff --git a/hibernate-core/src/main/java/org/hibernate/boot/models/xml/internal/ManagedTypeProcessor.java b/hibernate-core/src/main/java/org/hibernate/boot/models/xml/internal/ManagedTypeProcessor.java index 865cf8e0c7e6..c32ca6f321a7 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/models/xml/internal/ManagedTypeProcessor.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/models/xml/internal/ManagedTypeProcessor.java @@ -133,7 +133,6 @@ public static void processCompleteEntity( classDetails.forEachPersistableMember( memberDetails -> { final MutableMemberDetails mutableMemberDetails = (MutableMemberDetails) memberDetails; mutableMemberDetails.clearAnnotationUsages(); - mutableMemberDetails.addAnnotationUsage( JpaAnnotations.TRANSIENT.createUsage( xmlDocumentContext.getModelBuildingContext() ) ); } ); } @@ -720,7 +719,6 @@ private static void adjustCompleteNonDynamicTypeMember( MutableMemberDetails memberDetails, JaxbPersistentAttribute jaxbAttribute, XmlDocumentContext xmlDocumentContext) { - memberDetails.removeAnnotationUsage( JpaAnnotations.TRANSIENT ); CommonAttributeProcessing.applyAttributeAccessor( jaxbAttribute, memberDetails, diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/boot/models/xml/complete/CompletePartialTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/boot/models/xml/complete/CompletePartialTests.java index 3e498dde0485..00f594969b5b 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/boot/models/xml/complete/CompletePartialTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/boot/models/xml/complete/CompletePartialTests.java @@ -18,6 +18,7 @@ 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 @@ void testSourceModel(ServiceRegistryScope registryScope) { 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 @@ void testSourceModel(ServiceRegistryScope registryScope) { 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" ); } } diff --git a/hibernate-core/src/test/resources/mappings/models/dynamic/dynamic-id-class.xml b/hibernate-core/src/test/resources/mappings/models/dynamic/dynamic-id-class.xml index 4c212562a730..91f530406386 100644 --- a/hibernate-core/src/test/resources/mappings/models/dynamic/dynamic-id-class.xml +++ b/hibernate-core/src/test/resources/mappings/models/dynamic/dynamic-id-class.xml @@ -12,6 +12,7 @@ + \ No newline at end of file