diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/EmbeddableInstantiator.java b/hibernate-core/src/main/java/org/hibernate/annotations/EmbeddableInstantiator.java index 0cff061eea..873f4343ff 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/EmbeddableInstantiator.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/EmbeddableInstantiator.java @@ -21,5 +21,5 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; @Target( {TYPE, FIELD, METHOD, ANNOTATION_TYPE} ) @Retention( RUNTIME ) public @interface EmbeddableInstantiator { - Class value(); + Class value(); } diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/EmbeddableInstantiatorRegistration.java b/hibernate-core/src/main/java/org/hibernate/annotations/EmbeddableInstantiatorRegistration.java index 1db8a7bfe8..387c8187bf 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/EmbeddableInstantiatorRegistration.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/EmbeddableInstantiatorRegistration.java @@ -10,7 +10,7 @@ import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.PACKAGE; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java index c192a5988d..110944ac0a 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java @@ -99,7 +99,7 @@ import org.hibernate.mapping.SimpleValue; import org.hibernate.mapping.Table; import org.hibernate.mapping.UniqueKey; import org.hibernate.metamodel.CollectionClassification; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; import org.hibernate.query.named.NamedObjectRepository; import org.hibernate.query.sqm.function.SqmFunctionDescriptor; import org.hibernate.type.descriptor.java.JavaType; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/InFlightMetadataCollector.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/InFlightMetadataCollector.java index c0eaf85c17..ad9ab17dc6 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/InFlightMetadataCollector.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/InFlightMetadataCollector.java @@ -23,7 +23,6 @@ import org.hibernate.boot.internal.NamedProcedureCallDefinitionImpl; import org.hibernate.boot.model.IdentifierGeneratorDefinition; import org.hibernate.boot.model.TypeDefinition; import org.hibernate.boot.model.TypeDefinitionRegistry; -import org.hibernate.boot.model.convert.internal.InstanceBasedConverterDescriptor; import org.hibernate.boot.model.convert.spi.ConverterAutoApplyHandler; import org.hibernate.boot.model.convert.spi.ConverterDescriptor; import org.hibernate.boot.model.naming.Identifier; @@ -35,7 +34,6 @@ import org.hibernate.boot.query.NamedNativeQueryDefinition; import org.hibernate.boot.query.NamedProcedureCallDefinition; import org.hibernate.boot.query.NamedResultSetMappingDescriptor; import org.hibernate.cfg.AnnotatedClassType; -import org.hibernate.cfg.AttributeConverterDefinition; import org.hibernate.cfg.JPAIndexHolder; import org.hibernate.cfg.PropertyData; import org.hibernate.cfg.SecondPass; @@ -52,7 +50,7 @@ import org.hibernate.mapping.MappedSuperclass; import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Table; import org.hibernate.metamodel.CollectionClassification; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; import org.hibernate.type.descriptor.java.JavaType; import org.hibernate.type.descriptor.jdbc.JdbcType; import org.hibernate.usertype.UserCollectionType; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java index 312929b212..2a794246d2 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java @@ -138,7 +138,7 @@ import org.hibernate.mapping.SingleTableSubclass; import org.hibernate.mapping.Subclass; import org.hibernate.mapping.ToOne; import org.hibernate.mapping.UnionSubclass; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.resource.beans.spi.ManagedBean; import org.hibernate.resource.beans.spi.ManagedBeanRegistry; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java index 5d8b2a79d1..0adca5c114 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java @@ -105,7 +105,7 @@ import org.hibernate.mapping.Selectable; import org.hibernate.mapping.SimpleValue; import org.hibernate.mapping.Table; import org.hibernate.metamodel.CollectionClassification; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; import org.hibernate.resource.beans.spi.ManagedBean; import org.hibernate.resource.beans.spi.ManagedBeanRegistry; import org.hibernate.usertype.ParameterizedType; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/PropertyBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/PropertyBinder.java index 53ca498ba7..4cf9ff6101 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/PropertyBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/PropertyBinder.java @@ -39,7 +39,7 @@ import org.hibernate.mapping.RootClass; import org.hibernate.mapping.SimpleValue; import org.hibernate.mapping.ToOne; import org.hibernate.mapping.Value; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; import org.hibernate.tuple.AnnotationValueGeneration; import org.hibernate.tuple.AttributeBinder; import org.hibernate.tuple.GenerationTiming; diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java index ba9ba99023..07f5ed35dd 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java @@ -46,7 +46,6 @@ import org.hibernate.engine.internal.NonNullableTransientDependencies; import org.hibernate.internal.CoreLogging; import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.util.collections.CollectionHelper; -import org.hibernate.metadata.ClassMetadata; import org.hibernate.proxy.HibernateProxy; import org.hibernate.proxy.LazyInitializer; import org.hibernate.type.CollectionType; @@ -1256,27 +1255,24 @@ public class ActionQueue { * @param batchIdentifier The batch identifier of the entity affected by the action */ private void addParentChildEntityNames(AbstractEntityInsertAction action, BatchIdentifier batchIdentifier) { - Object[] propertyValues = action.getState(); - ClassMetadata classMetadata = action.getPersister().getClassMetadata(); - if ( classMetadata != null ) { - Type[] propertyTypes = classMetadata.getPropertyTypes(); - Type identifierType = classMetadata.getIdentifierType(); + final Object[] propertyValues = action.getState(); + final Type[] propertyTypes = action.getPersister().getPropertyTypes(); + final Type identifierType = action.getPersister().getIdentifierType(); - for ( int i = 0; i < propertyValues.length; i++ ) { - Object value = propertyValues[i]; - if ( value != null ) { - Type type = propertyTypes[i]; - addParentChildEntityNameByPropertyAndValue( action, batchIdentifier, type, value ); - } + for ( int i = 0; i < propertyValues.length; i++ ) { + Object value = propertyValues[i]; + if ( value != null ) { + Type type = propertyTypes[i]; + addParentChildEntityNameByPropertyAndValue( action, batchIdentifier, type, value ); } + } - if ( identifierType.isComponentType() ) { - CompositeType compositeType = (CompositeType) identifierType; - Type[] compositeIdentifierTypes = compositeType.getSubtypes(); + if ( identifierType.isComponentType() ) { + CompositeType compositeType = (CompositeType) identifierType; + Type[] compositeIdentifierTypes = compositeType.getSubtypes(); - for ( Type type : compositeIdentifierTypes ) { - addParentChildEntityNameByPropertyAndValue( action, batchIdentifier, type, null ); - } + for ( Type type : compositeIdentifierTypes ) { + addParentChildEntityNameByPropertyAndValue( action, batchIdentifier, type, null ); } } } diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEntityEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEntityEventListener.java index 83b31cf503..f9e603f3a2 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEntityEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEntityEventListener.java @@ -25,6 +25,7 @@ import org.hibernate.engine.spi.PersistenceContext; import org.hibernate.engine.spi.PersistentAttributeInterceptable; import org.hibernate.engine.spi.PersistentAttributeInterceptor; import org.hibernate.engine.spi.SelfDirtinessTracker; +import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.Status; import org.hibernate.event.spi.EventSource; @@ -35,7 +36,8 @@ import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.jpa.event.spi.CallbackRegistry; import org.hibernate.jpa.event.spi.CallbackRegistryConsumer; -import org.hibernate.metadata.ClassMetadata; +import org.hibernate.metamodel.RuntimeMetamodels; +import org.hibernate.metamodel.mapping.EntityMappingType; import org.hibernate.metamodel.mapping.NaturalIdMapping; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.pretty.MessageHelper; @@ -354,8 +356,11 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener private boolean copyState(Object entity, Type[] types, Object[] state, SessionFactory sf) { // copy the entity state into the state array and return true if the state has changed - ClassMetadata metadata = sf.getClassMetadata( entity.getClass() ); - Object[] newState = metadata.getPropertyValues( entity ); + final SessionFactoryImplementor sessionFactory = sf.unwrap( SessionFactoryImplementor.class ); + final RuntimeMetamodels runtimeMetamodels = sessionFactory.getRuntimeMetamodels(); + final EntityMappingType entityMappingType = runtimeMetamodels.getEntityMappingType( entity.getClass() ); + final Object[] newState = entityMappingType.getEntityPersister().getValues( entity ); + int size = newState.length; boolean isDirty = false; for ( int index = 0; index < size; index++ ) { diff --git a/hibernate-core/src/main/java/org/hibernate/loader/PropertyPath.java b/hibernate-core/src/main/java/org/hibernate/loader/PropertyPath.java index a1cd1bfd52..f6f9470321 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/PropertyPath.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/PropertyPath.java @@ -7,12 +7,13 @@ package org.hibernate.loader; import org.hibernate.internal.util.StringHelper; +import org.hibernate.spi.DotIdentifierSequence; import org.hibernate.query.spi.NavigablePath; /** * @author Steve Ebersole */ -public class PropertyPath { +public class PropertyPath implements DotIdentifierSequence { public static final String IDENTIFIER_MAPPER_PROPERTY = NavigablePath.IDENTIFIER_MAPPER_PROPERTY; @@ -65,6 +66,11 @@ public class PropertyPath { return parent; } + @Override + public String getLocalName() { + return property; + } + public String getProperty() { return property; } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Component.java b/hibernate-core/src/main/java/org/hibernate/mapping/Component.java index 6cdbcab7e6..3ec12618df 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Component.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Component.java @@ -27,7 +27,7 @@ import org.hibernate.id.IdentifierGenerator; import org.hibernate.id.factory.IdentifierGeneratorFactory; import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.internal.util.collections.JoinedIterator; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; import org.hibernate.property.access.spi.Setter; import org.hibernate.type.ComponentType; import org.hibernate.type.EmbeddedComponentType; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/AttributeClassification.java b/hibernate-core/src/main/java/org/hibernate/metamodel/AttributeClassification.java index 0efc1a14ca..f42c61cfd7 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/AttributeClassification.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/AttributeClassification.java @@ -6,16 +6,57 @@ */ package org.hibernate.metamodel; +import org.hibernate.Incubating; + import jakarta.persistence.metamodel.Attribute.PersistentAttributeType; +/** + * An extended set of {@link PersistentAttributeType} adding {@link #ANY} + * + * @since 6.0 + * + */ +@Incubating public enum AttributeClassification { + /** + * @see jakarta.persistence.Basic + */ BASIC( PersistentAttributeType.BASIC ), + + /** + * @see jakarta.persistence.Embedded + */ + EMBEDDED( PersistentAttributeType.EMBEDDED ), + + /** + * @see org.hibernate.annotations.Any + */ ANY( null ), + + /** + * @see jakarta.persistence.OneToOne + */ ONE_TO_ONE( PersistentAttributeType.ONE_TO_ONE ), + + /** + * @see jakarta.persistence.ManyToOne + */ MANY_TO_ONE( PersistentAttributeType.MANY_TO_ONE ), + + /** + * @see jakarta.persistence.ElementCollection + */ ELEMENT_COLLECTION( PersistentAttributeType.ELEMENT_COLLECTION ), + + /** + * @see jakarta.persistence.OneToMany + */ ONE_TO_MANY( PersistentAttributeType.ONE_TO_MANY ), + + /** + * @see jakarta.persistence.ManyToMany + */ MANY_TO_MANY( PersistentAttributeType.MANY_TO_MANY ); private final PersistentAttributeType jpaClassification; @@ -24,6 +65,9 @@ public enum AttributeClassification { this.jpaClassification = jpaClassification; } + /** + * The associated {@link PersistentAttributeType}, if one + */ public PersistentAttributeType getJpaClassification() { return jpaClassification; } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AbstractEmbeddableRepresentationStrategy.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AbstractEmbeddableRepresentationStrategy.java index 37a30e2cbf..92dddeceb4 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AbstractEmbeddableRepresentationStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AbstractEmbeddableRepresentationStrategy.java @@ -12,7 +12,7 @@ import java.util.concurrent.ConcurrentHashMap; import org.hibernate.mapping.Component; import org.hibernate.mapping.Property; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; +import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.property.access.spi.PropertyAccess; import org.hibernate.type.descriptor.java.JavaType; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java index 2ff2479c0a..0e07191a35 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java @@ -44,7 +44,7 @@ import org.hibernate.metamodel.model.domain.internal.MapMember; import org.hibernate.metamodel.model.domain.internal.MappedSuperclassTypeImpl; import org.hibernate.metamodel.model.domain.internal.PluralAttributeBuilder; import org.hibernate.metamodel.model.domain.internal.SingularAttributeImpl; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; +import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.property.access.internal.PropertyAccessMapImpl; import org.hibernate.property.access.spi.Getter; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyMap.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyMap.java index 5de9f50958..a166313085 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyMap.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyMap.java @@ -14,8 +14,8 @@ import org.hibernate.mapping.Component; import org.hibernate.mapping.Property; import org.hibernate.metamodel.RepresentationMode; import org.hibernate.metamodel.mapping.EmbeddableMappingType; -import org.hibernate.metamodel.EmbeddableInstantiator; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.property.access.internal.PropertyAccessStrategyMapImpl; import org.hibernate.property.access.spi.PropertyAccess; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyPojo.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyPojo.java index 70e26362d2..ae5381f176 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyPojo.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyPojo.java @@ -24,7 +24,7 @@ import org.hibernate.mapping.IndexBackref; import org.hibernate.mapping.Property; import org.hibernate.metamodel.RepresentationMode; import org.hibernate.metamodel.mapping.EmbeddableMappingType; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.property.access.internal.PropertyAccessStrategyBackRefImpl; import org.hibernate.property.access.internal.PropertyAccessStrategyIndexBackRefImpl; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/ManagedTypeRepresentationResolverStandard.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/ManagedTypeRepresentationResolverStandard.java index 2a87b74ca6..819927cd70 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/ManagedTypeRepresentationResolverStandard.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/ManagedTypeRepresentationResolverStandard.java @@ -13,8 +13,8 @@ import org.hibernate.mapping.Component; import org.hibernate.mapping.PersistentClass; import org.hibernate.metamodel.RepresentationMode; import org.hibernate.metamodel.mapping.EmbeddableMappingType; -import org.hibernate.metamodel.EmbeddableInstantiator; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.metamodel.spi.EntityRepresentationStrategy; import org.hibernate.metamodel.spi.ManagedTypeRepresentationResolver; import org.hibernate.metamodel.spi.RuntimeModelCreationContext; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardEmbeddableInstantiator.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardEmbeddableInstantiator.java index f4f82cba15..536ae59d32 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardEmbeddableInstantiator.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardEmbeddableInstantiator.java @@ -6,7 +6,7 @@ */ package org.hibernate.metamodel.internal; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; /** * Marker interface for standard EmbeddableInstantiator implementations. diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EmbeddableMappingType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EmbeddableMappingType.java index f730c0dc79..1acd9d69c4 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EmbeddableMappingType.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EmbeddableMappingType.java @@ -12,7 +12,7 @@ import java.util.function.BiConsumer; import org.hibernate.mapping.IndexedConsumer; import org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping; import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; +import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.query.spi.NavigablePath; import org.hibernate.sql.ast.spi.SqlSelection; import org.hibernate.sql.ast.tree.from.TableGroup; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Queryable.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Queryable.java index 6a365e9f48..1cbd5c4612 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Queryable.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Queryable.java @@ -8,7 +8,7 @@ package org.hibernate.metamodel.mapping; import java.util.function.Consumer; -import org.hibernate.query.DotIdentifierSequence; +import org.hibernate.spi.DotIdentifierSequence; import org.hibernate.boot.spi.SessionFactoryOptions; /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractEmbeddableMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractEmbeddableMapping.java index f8f2bd3c03..90dc109fc4 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractEmbeddableMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractEmbeddableMapping.java @@ -32,7 +32,7 @@ import org.hibernate.metamodel.mapping.EmbeddableMappingType; import org.hibernate.metamodel.mapping.StateArrayContributorMetadata; import org.hibernate.metamodel.mapping.StateArrayContributorMetadataAccess; import org.hibernate.metamodel.model.domain.NavigableRole; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; +import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.property.access.internal.PropertyAccessStrategyBackRefImpl; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/EmbeddableMappingTypeImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/EmbeddableMappingTypeImpl.java index b8d65de199..f2861b26da 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/EmbeddableMappingTypeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/EmbeddableMappingTypeImpl.java @@ -49,7 +49,7 @@ import org.hibernate.metamodel.mapping.SelectableMappings; import org.hibernate.metamodel.mapping.StateArrayContributorMetadata; import org.hibernate.metamodel.mapping.StateArrayContributorMetadataAccess; import org.hibernate.metamodel.model.domain.NavigableRole; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; +import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.property.access.spi.PropertyAccess; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/IdClassEmbeddable.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/IdClassEmbeddable.java index a7f9e5eba0..fa466d60f7 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/IdClassEmbeddable.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/IdClassEmbeddable.java @@ -35,7 +35,7 @@ import org.hibernate.metamodel.mapping.SelectableMappings; import org.hibernate.metamodel.mapping.SingularAttributeMapping; import org.hibernate.metamodel.mapping.StateArrayContributorMetadataAccess; import org.hibernate.metamodel.model.domain.NavigableRole; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; +import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.property.access.internal.PropertyAccessStrategyMapImpl; import org.hibernate.property.access.spi.PropertyAccess; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/IdClassRepresentationStrategy.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/IdClassRepresentationStrategy.java index 60879e3b88..ad446e5ddc 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/IdClassRepresentationStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/IdClassRepresentationStrategy.java @@ -10,8 +10,8 @@ import org.hibernate.bytecode.spi.ReflectionOptimizer; import org.hibernate.mapping.Property; import org.hibernate.metamodel.RepresentationMode; import org.hibernate.metamodel.internal.EmbeddableInstantiatorPojoStandard; -import org.hibernate.metamodel.EmbeddableInstantiator; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.property.access.internal.PropertyAccessStrategyMixedImpl; import org.hibernate.property.access.spi.PropertyAccess; import org.hibernate.type.descriptor.java.JavaType; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/VirtualIdRepresentationStrategy.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/VirtualIdRepresentationStrategy.java index e5abeb7f67..b3d4bc194f 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/VirtualIdRepresentationStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/VirtualIdRepresentationStrategy.java @@ -18,8 +18,8 @@ import org.hibernate.metamodel.RepresentationMode; import org.hibernate.metamodel.internal.EmbeddableInstantiatorProxied; import org.hibernate.metamodel.internal.StandardEmbeddableInstantiator; import org.hibernate.metamodel.mapping.EntityMappingType; -import org.hibernate.metamodel.EmbeddableInstantiator; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.metamodel.spi.EntityInstantiator; import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.property.access.spi.PropertyAccess; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/Converters.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/spi/Converters.java similarity index 92% rename from hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/Converters.java rename to hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/spi/Converters.java index 19c2fd3bc1..c6a3c82b12 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/Converters.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/spi/Converters.java @@ -4,26 +4,28 @@ * 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.metamodel.model.convert; - -import jakarta.persistence.AttributeConverter; +package org.hibernate.metamodel.model.convert.spi; import org.hibernate.SessionFactory; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.metamodel.model.convert.internal.JpaAttributeConverterImpl; -import org.hibernate.metamodel.model.convert.spi.BasicValueConverter; import org.hibernate.resource.beans.spi.ManagedBean; import org.hibernate.resource.beans.spi.ManagedBeanRegistry; import org.hibernate.type.descriptor.java.JavaType; import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry; import org.hibernate.type.spi.TypeConfiguration; +import jakarta.persistence.AttributeConverter; + /** * Factory for converter instances * * @author Steve Ebersole */ public class Converters { + /** + * Generates a BasicValueConverter based on an {@link AttributeConverter} + */ public static BasicValueConverter jpaAttributeConverter( JavaType relationalJtd, JavaType domainJtd, diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/NavigableRole.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/NavigableRole.java index 2024f196ab..d53f67c21c 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/NavigableRole.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/NavigableRole.java @@ -8,7 +8,7 @@ package org.hibernate.metamodel.model.domain; import java.util.Objects; -import org.hibernate.query.DotIdentifierSequence; +import org.hibernate.spi.DotIdentifierSequence; import org.hibernate.internal.util.StringHelper; import org.hibernate.query.spi.NavigablePath; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/EmbeddableInstantiator.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/EmbeddableInstantiator.java similarity index 96% rename from hibernate-core/src/main/java/org/hibernate/metamodel/EmbeddableInstantiator.java rename to hibernate-core/src/main/java/org/hibernate/metamodel/spi/EmbeddableInstantiator.java index 4cf43af770..1cbbd975ba 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/EmbeddableInstantiator.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/EmbeddableInstantiator.java @@ -4,7 +4,7 @@ * 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.metamodel; +package org.hibernate.metamodel.spi; import java.util.function.Supplier; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/EmbeddableRepresentationStrategy.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/EmbeddableRepresentationStrategy.java similarity index 96% rename from hibernate-core/src/main/java/org/hibernate/metamodel/EmbeddableRepresentationStrategy.java rename to hibernate-core/src/main/java/org/hibernate/metamodel/spi/EmbeddableRepresentationStrategy.java index 80cbaffbfa..880751feac 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/EmbeddableRepresentationStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/EmbeddableRepresentationStrategy.java @@ -4,7 +4,7 @@ * 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.metamodel; +package org.hibernate.metamodel.spi; import org.hibernate.Incubating; import org.hibernate.bytecode.spi.ReflectionOptimizer; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/EntityRepresentationStrategy.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/EntityRepresentationStrategy.java index 1c86ba9e84..14525c1244 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/EntityRepresentationStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/EntityRepresentationStrategy.java @@ -9,7 +9,6 @@ package org.hibernate.metamodel.spi; import java.util.function.Consumer; import org.hibernate.EntityNameResolver; -import org.hibernate.metamodel.ManagedTypeRepresentationStrategy; import org.hibernate.proxy.ProxyFactory; import org.hibernate.type.descriptor.java.JavaType; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/ManagedTypeRepresentationResolver.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/ManagedTypeRepresentationResolver.java index a7f7aa5f04..542c538184 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/ManagedTypeRepresentationResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/ManagedTypeRepresentationResolver.java @@ -11,7 +11,6 @@ import java.util.function.Supplier; import org.hibernate.Incubating; import org.hibernate.mapping.Component; import org.hibernate.mapping.PersistentClass; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; import org.hibernate.metamodel.mapping.EmbeddableMappingType; import org.hibernate.persister.entity.EntityPersister; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/ManagedTypeRepresentationStrategy.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/ManagedTypeRepresentationStrategy.java similarity index 93% rename from hibernate-core/src/main/java/org/hibernate/metamodel/ManagedTypeRepresentationStrategy.java rename to hibernate-core/src/main/java/org/hibernate/metamodel/spi/ManagedTypeRepresentationStrategy.java index bbadbc18bf..cdbf3c187a 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/ManagedTypeRepresentationStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/ManagedTypeRepresentationStrategy.java @@ -4,11 +4,12 @@ * 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.metamodel; +package org.hibernate.metamodel.spi; import org.hibernate.Incubating; import org.hibernate.bytecode.spi.ReflectionOptimizer; import org.hibernate.mapping.Property; +import org.hibernate.metamodel.RepresentationMode; import org.hibernate.property.access.spi.PropertyAccess; import org.hibernate.type.descriptor.java.JavaType; diff --git a/hibernate-core/src/main/java/org/hibernate/property/access/spi/PropertyAccess.java b/hibernate-core/src/main/java/org/hibernate/property/access/spi/PropertyAccess.java index 748965a22b..eab258414a 100644 --- a/hibernate-core/src/main/java/org/hibernate/property/access/spi/PropertyAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/property/access/spi/PropertyAccess.java @@ -6,13 +6,15 @@ */ package org.hibernate.property.access.spi; +import org.hibernate.metamodel.spi.ManagedTypeRepresentationStrategy; + /** * Describes access to a particular persistent property in terms of getting and setting * values. *

* Instances are obtained from {@link PropertyAccessStrategy} * - * @see org.hibernate.metamodel.ManagedTypeRepresentationStrategy + * @see ManagedTypeRepresentationStrategy * * @author Steve Ebersole * @author Gavin King diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/FullyQualifiedReflectivePathSource.java b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/FullyQualifiedReflectivePathSource.java index f8c33b3580..b6a9ab0095 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/FullyQualifiedReflectivePathSource.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/FullyQualifiedReflectivePathSource.java @@ -6,7 +6,7 @@ */ package org.hibernate.query.hql.internal; -import org.hibernate.query.DotIdentifierSequence; +import org.hibernate.spi.DotIdentifierSequence; import org.hibernate.query.hql.spi.SemanticPathPart; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/spi/NavigablePath.java b/hibernate-core/src/main/java/org/hibernate/query/spi/NavigablePath.java index 537ffbb344..63b5b5fabc 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/spi/NavigablePath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/spi/NavigablePath.java @@ -9,7 +9,7 @@ package org.hibernate.query.spi; import java.io.Serializable; import org.hibernate.internal.util.StringHelper; -import org.hibernate.query.DotIdentifierSequence; +import org.hibernate.spi.DotIdentifierSequence; import org.hibernate.query.sqm.spi.EntityIdentifierNavigablePath; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/DotIdentifierSequence.java b/hibernate-core/src/main/java/org/hibernate/spi/DotIdentifierSequence.java similarity index 98% rename from hibernate-core/src/main/java/org/hibernate/query/DotIdentifierSequence.java rename to hibernate-core/src/main/java/org/hibernate/spi/DotIdentifierSequence.java index 45cb428af3..f2805d798f 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/DotIdentifierSequence.java +++ b/hibernate-core/src/main/java/org/hibernate/spi/DotIdentifierSequence.java @@ -4,7 +4,7 @@ * 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.query; +package org.hibernate.spi; import java.util.function.BiFunction; diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/embeddable/AbstractEmbeddableInitializer.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/embeddable/AbstractEmbeddableInitializer.java index 3a9c5752a3..7f0985e5ed 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/embeddable/AbstractEmbeddableInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/embeddable/AbstractEmbeddableInitializer.java @@ -21,7 +21,7 @@ import org.hibernate.metamodel.mapping.EntityIdentifierMapping; import org.hibernate.metamodel.mapping.ForeignKeyDescriptor; import org.hibernate.metamodel.mapping.VirtualModelPart; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; +import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.property.access.spi.PropertyAccess; import org.hibernate.proxy.HibernateProxy; import org.hibernate.query.spi.NavigablePath; diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/Instantiator.java b/hibernate-core/src/main/java/org/hibernate/tuple/Instantiator.java index 4528f489df..8d2d721038 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/Instantiator.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/Instantiator.java @@ -8,7 +8,7 @@ package org.hibernate.tuple; import java.io.Serializable; -import org.hibernate.metamodel.ManagedTypeRepresentationStrategy; +import org.hibernate.metamodel.spi.ManagedTypeRepresentationStrategy; /** * Contract for implementors responsible for instantiating entity/component instances. diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java index 9c0c04ae1f..5102676690 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java @@ -6,7 +6,7 @@ */ package org.hibernate.tuple; -import org.hibernate.metamodel.ManagedTypeRepresentationStrategy; +import org.hibernate.metamodel.spi.ManagedTypeRepresentationStrategy; import org.hibernate.metamodel.RepresentationMode; import org.hibernate.property.access.spi.Getter; diff --git a/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java b/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java index 243405a4b4..d23683a5df 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java @@ -33,7 +33,7 @@ import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.mapping.Component; import org.hibernate.mapping.Property; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart; import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess; import org.hibernate.property.access.spi.PropertyAccess; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entity/MonetaryAmountInstantiator.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entity/MonetaryAmountInstantiator.java index 3becd68bfc..4b825bdca8 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entity/MonetaryAmountInstantiator.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entity/MonetaryAmountInstantiator.java @@ -11,7 +11,7 @@ import java.util.Currency; import java.util.function.Supplier; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; /** * @author Steve Ebersole diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/naturalid/NaturalIdTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/naturalid/NaturalIdTest.java index ebc5937f95..b5d92a28df 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/naturalid/NaturalIdTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/naturalid/NaturalIdTest.java @@ -14,7 +14,8 @@ import org.hibernate.NaturalIdLoadAccess; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; -import org.hibernate.metadata.ClassMetadata; +import org.hibernate.metamodel.mapping.EntityMappingType; +import org.hibernate.metamodel.mapping.NaturalIdMapping; import org.hibernate.query.Query; import org.hibernate.stat.Statistics; @@ -22,9 +23,9 @@ import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.junit.After; import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; /** * Test case for NaturalId annotation @@ -48,15 +49,19 @@ public class NaturalIdTest extends BaseCoreFunctionalTestCase { @Test public void testMappingProperties() { - ClassMetadata metaData = sessionFactory().getClassMetadata( - Citizen.class - ); - assertTrue( - "Class should have a natural key", metaData - .hasNaturalIdentifier() - ); - int[] propertiesIndex = metaData.getNaturalIdentifierProperties(); - assertTrue( "Wrong number of elements", propertiesIndex.length == 2 ); + final EntityMappingType citizenEntityMapping = sessionFactory() + .getRuntimeMetamodels() + .getEntityMappingType( Citizen.class ); + + final NaturalIdMapping naturalIdMapping = citizenEntityMapping.getNaturalIdMapping(); + + assertThat( naturalIdMapping ) + .withFailMessage( "Class should have a natural key" ) + .isNotNull(); + + assertThat( naturalIdMapping.getNaturalIdAttributes() ) + .withFailMessage( "Expecting 2 natural-id attributes, got " + naturalIdMapping.getNaturalIdAttributes().size() ) + .hasSize( 2 ); } @Test diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/component/proxy/ComponentBasicProxyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/component/proxy/ComponentBasicProxyTest.java index 02d626702d..72f23cef1c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/component/proxy/ComponentBasicProxyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/component/proxy/ComponentBasicProxyTest.java @@ -11,7 +11,7 @@ import java.util.List; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.mapping.PersistentClass; import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; import org.hibernate.type.spi.CompositeTypeImplementor; import org.hibernate.testing.TestForIssue; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embeddable/InstantiationTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embeddable/InstantiationTests.java index 82569d89cd..041ac2049e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embeddable/InstantiationTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embeddable/InstantiationTests.java @@ -6,7 +6,7 @@ */ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embeddable; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.SessionFactory; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embeddable/NameInstantiator.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embeddable/NameInstantiator.java index ed69ccd66d..8f14e236b8 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embeddable/NameInstantiator.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embeddable/NameInstantiator.java @@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embeddab import java.util.function.Supplier; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; /** * @author Steve Ebersole diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embedded/InstantiationTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embedded/InstantiationTests.java index 2938927aa4..efd4b7ebc5 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embedded/InstantiationTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embedded/InstantiationTests.java @@ -6,7 +6,7 @@ */ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embedded; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.SessionFactory; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embedded/NameInstantiator.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embedded/NameInstantiator.java index 5135dd8c75..c777a12128 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embedded/NameInstantiator.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embedded/NameInstantiator.java @@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embedded import java.util.function.Supplier; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; /** * @author Steve Ebersole diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embedded/package-info.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embedded/package-info.java index f2d503865b..73ee2a4d75 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embedded/package-info.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/embedded/package-info.java @@ -6,6 +6,6 @@ */ /** - * Tests for custom {@link org.hibernate.metamodel.EmbeddableInstantiator} usage + * Tests for custom {@link org.hibernate.metamodel.spi.EmbeddableInstantiator} usage */ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embedded; \ No newline at end of file diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf/InstantiationTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf/InstantiationTests.java index ddda5089d9..b2b7e3166c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf/InstantiationTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf/InstantiationTests.java @@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.intf; import org.hibernate.mapping.Collection; import org.hibernate.mapping.Component; import org.hibernate.mapping.Property; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; +import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.metamodel.MappingMetamodel; import org.hibernate.metamodel.RepresentationMode; import org.hibernate.metamodel.RuntimeMetamodels; @@ -19,7 +19,6 @@ import org.hibernate.persister.entity.EntityPersister; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.DomainModelScope; -import org.hibernate.testing.orm.junit.FailureExpected; import org.hibernate.testing.orm.junit.JiraKey; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf/NameInstantiator.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf/NameInstantiator.java index bd65707691..4ceb4631e8 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf/NameInstantiator.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf/NameInstantiator.java @@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.intf; import java.util.function.Supplier; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; /** * @author Steve Ebersole diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf2/InstantiationTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf2/InstantiationTests.java index 1bbf51ddca..97243c75e1 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf2/InstantiationTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf2/InstantiationTests.java @@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.intf2; import org.hibernate.mapping.Collection; import org.hibernate.mapping.Component; import org.hibernate.mapping.Property; -import org.hibernate.metamodel.EmbeddableRepresentationStrategy; +import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.metamodel.MappingMetamodel; import org.hibernate.metamodel.RepresentationMode; import org.hibernate.metamodel.RuntimeMetamodels; @@ -19,7 +19,6 @@ import org.hibernate.persister.entity.EntityPersister; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.DomainModelScope; -import org.hibernate.testing.orm.junit.FailureExpected; import org.hibernate.testing.orm.junit.JiraKey; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf2/NameInstantiator.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf2/NameInstantiator.java index 7c4256d6a6..6accb3445f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf2/NameInstantiator.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/intf2/NameInstantiator.java @@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.intf2; import java.util.function.Supplier; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; /** * @author Steve Ebersole diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/registered/InstantiationTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/registered/InstantiationTests.java index 56b72a1e31..4ed14c0e2b 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/registered/InstantiationTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/registered/InstantiationTests.java @@ -6,7 +6,7 @@ */ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.registered; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.SessionFactory; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/registered/NameInstantiator.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/registered/NameInstantiator.java index 0b7587bab5..c3bc64f815 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/registered/NameInstantiator.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/strategy/instantiator/registered/NameInstantiator.java @@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.register import java.util.function.Supplier; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.metamodel.EmbeddableInstantiator; +import org.hibernate.metamodel.spi.EmbeddableInstantiator; /** * @author Steve Ebersole diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/TableCommentTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/TableCommentTest.java index 0c5384608b..ead05e9e19 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/TableCommentTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/TableCommentTest.java @@ -18,7 +18,7 @@ import jakarta.persistence.Id; import org.hibernate.annotations.Table; import org.hibernate.boot.MetadataSources; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.metadata.ClassMetadata; +import org.hibernate.metamodel.mapping.EntityMappingType; import org.hibernate.persister.entity.AbstractEntityPersister; import org.hibernate.tool.hbm2ddl.SchemaExport; import org.hibernate.tool.schema.TargetType; @@ -98,9 +98,12 @@ public class TableCommentTest extends BaseNonConfigCoreFunctionalTestCase { } private String getTableName() { - SessionFactoryImplementor sessionFactoryImplementor = sessionFactory(); - ClassMetadata tableWithCommentMetadata = sessionFactoryImplementor.getClassMetadata( TableWithComment.class ); - return ((AbstractEntityPersister) tableWithCommentMetadata).getTableName(); + final SessionFactoryImplementor sessionFactory = sessionFactory(); + final EntityMappingType entityMappingType = sessionFactory + .getRuntimeMetamodels() + .getEntityMappingType( TableWithComment.class ); + + return ( (AbstractEntityPersister) entityMappingType ).getTableName(); } private void createSchema(Class[] annotatedClasses) {