From 9724fb0d9b8372c34d1f8246ca7a93ec3c2e7ca3 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sun, 23 Jan 2022 11:09:18 +0100 Subject: [PATCH] actually remove deprecated operations of SessionFactoryImplementor and SessionImplementor --- .../src/main/java/org/hibernate/Session.java | 4 +- .../cache/spi/entry/StructuredCacheEntry.java | 2 +- .../spi/AbstractPersistentCollection.java | 10 +- .../PessimisticReadUpdateLockingStrategy.java | 2 +- ...PessimisticWriteUpdateLockingStrategy.java | 2 +- .../dialect/lock/UpdateLockingStrategy.java | 2 +- .../engine/internal/AbstractEntityEntry.java | 24 +-- .../hibernate/engine/internal/Cascade.java | 2 +- .../jdbc/batch/internal/NonBatchingBatch.java | 11 +- .../jdbc/internal/JdbcCoordinatorImpl.java | 4 +- .../jdbc/internal/ResultSetReturnImpl.java | 2 +- .../hibernate/engine/spi/CollectionKey.java | 2 +- .../org/hibernate/engine/spi/EntityKey.java | 2 +- .../engine/spi/SessionDelegatorBaseImpl.java | 5 - .../spi/SessionFactoryDelegatingImpl.java | 79 ++------ .../engine/spi/SessionFactoryImplementor.java | 171 +----------------- .../engine/spi/SessionImplementor.java | 39 ++-- .../internal/DefaultEvictEventListener.java | 4 +- .../internal/DefaultPersistEventListener.java | 6 +- .../event/internal/OnLockVisitor.java | 2 +- .../event/internal/OnUpdateVisitor.java | 6 +- .../event/internal/ProxyVisitor.java | 6 +- .../hibernate/event/internal/WrapVisitor.java | 2 +- .../internal/FilterConfiguration.java | 2 +- .../internal/SessionFactoryImpl.java | 58 +++--- .../org/hibernate/internal/SessionImpl.java | 5 - .../internal/util/EntityPrinter.java | 2 +- .../entity/CacheEntityLoaderHelper.java | 5 +- .../collection/OneToManyPersister.java | 6 +- .../persister/entity/DiscriminatorType.java | 6 +- .../entity/JoinedSubclassEntityPersister.java | 20 +- .../proxy/AbstractLazyInitializer.java | 10 +- .../internal/ResultSetMappingProcessor.java | 4 +- .../org/hibernate/type/CollectionType.java | 7 +- .../entitynonentity/EntityNonEntityTest.java | 6 +- .../EnumeratedWithMappedSuperclassTest.java | 2 +- .../NewGeneratorMappingsTest.java | 14 +- .../id/sequences/HibernateSequenceTest.java | 3 +- .../annotations/lob/MaterializedBlobTest.java | 4 +- .../annotations/onetomany/OrderByTest.java | 3 +- .../QualifiedTableNamingTest.java | 2 +- .../access/jpa/AccessMappingTest.java | 30 +-- .../cache/CollectionCacheEvictionTest.java | 2 +- ...onedCascadeDereferencedCollectionTest.java | 16 +- ...edNoCascadeDereferencedCollectionTest.java | 16 +- ...onedCascadeDereferencedCollectionTest.java | 16 +- ...edNoCascadeDereferencedCollectionTest.java | 16 +- .../collection/list/PersistentListTest.java | 6 +- .../BatchFetchStrategyHelperTest.java | 4 +- .../FetchStrategyHelperTest.java | 4 +- .../NoProxyFetchStrategyHelperTest.java | 4 +- .../orm/test/filter/DynamicFilterTest.java | 2 +- .../orm/test/hql/BulkManipulationTest.java | 2 +- .../BasicForcedTableSequenceTest.java | 3 +- .../HiLoForcedTableSequenceTest.java | 2 +- .../PooledForcedTableSequenceTest.java | 2 +- .../enhanced/sequence/BasicSequenceTest.java | 6 +- .../HiLoSequenceMismatchStrategyTest.java | 3 +- .../enhanced/sequence/HiLoSequenceTest.java | 2 +- .../enhanced/sequence/PooledSequenceTest.java | 2 +- .../idgen/enhanced/table/BasicTableTest.java | 2 +- .../idgen/enhanced/table/HiLoTableTest.java | 2 +- .../idgen/enhanced/table/PooledTableTest.java | 2 +- .../AbstractEntityWithManyToManyTest.java | 4 +- ...SubclassWithExplicitDiscriminatorTest.java | 4 +- ...sWithIgnoredExplicitDiscriminatorTest.java | 4 +- ...SubclassWithImplicitDiscriminatorTest.java | 4 +- .../BasicJodaTimeConversionTest.java | 2 +- .../converter/DirtyCheckingTest.java | 2 +- .../converter/ExplicitDateConvertersTest.java | 2 +- .../converter/ExplicitEnumConvertersTest.java | 2 +- .../SimpleConvertAnnotationTest.java | 2 +- .../SimpleConvertsAnnotationTest.java | 2 +- ...mpleEmbeddableOverriddenConverterTest.java | 2 +- .../SimpleOverriddenConverterTest.java | 2 +- ...XmlWithExplicitConvertAnnotationsTest.java | 2 +- .../cache/CacheLazyLoadNoTransTest.java | 2 +- .../CustomSqlSchemaResolvingIdentityTest.java | 4 +- .../entity/CustomSqlSchemaResolvingTest.java | 2 +- .../hibernate/orm/test/proxy/ProxyTest.java | 4 +- ...aseTimestampComparisonAnnotationsTest.java | 4 +- .../sybase/SybaseTimestampVersioningTest.java | 4 +- .../java/org/hibernate/test/tm/CMTTest.java | 2 +- .../MonotonicRevisionNumberTest.java | 2 +- 84 files changed, 242 insertions(+), 508 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/Session.java b/hibernate-core/src/main/java/org/hibernate/Session.java index 381444c89b..d1de3e1245 100644 --- a/hibernate-core/src/main/java/org/hibernate/Session.java +++ b/hibernate-core/src/main/java/org/hibernate/Session.java @@ -1299,9 +1299,7 @@ public interface Session extends SharedSessionContract, EntityManager { RootGraph getEntityGraph(String graphName); @Override - default List> getEntityGraphs(Class entityClass) { - return getSessionFactory().findEntityGraphsByType( entityClass ); - } + List> getEntityGraphs(Class entityClass); // The following overrides should not be necessary, // and are only needed to work around a bug in IntelliJ diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/entry/StructuredCacheEntry.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/entry/StructuredCacheEntry.java index 46e0738a60..31c7b9e4f6 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/entry/StructuredCacheEntry.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/entry/StructuredCacheEntry.java @@ -41,7 +41,7 @@ public class StructuredCacheEntry implements CacheEntryStructure { final Map map = (Map) structured; final String subclass = (String) map.get( SUBCLASS_KEY ); final Object version = map.get( VERSION_KEY ); - final EntityPersister subclassPersister = factory.getEntityPersister( subclass ); + final EntityPersister subclassPersister = factory.getMetamodel().entityPersister(subclass); final String[] names = subclassPersister.getPropertyNames(); final Serializable[] disassembledState = new Serializable[names.length]; for ( int i = 0; i < names.length; i++ ) { diff --git a/hibernate-core/src/main/java/org/hibernate/collection/spi/AbstractPersistentCollection.java b/hibernate-core/src/main/java/org/hibernate/collection/spi/AbstractPersistentCollection.java index 7780e70424..1d1b7ceccc 100644 --- a/hibernate-core/src/main/java/org/hibernate/collection/spi/AbstractPersistentCollection.java +++ b/hibernate-core/src/main/java/org/hibernate/collection/spi/AbstractPersistentCollection.java @@ -245,7 +245,7 @@ public abstract class AbstractPersistentCollection implements Serializable, P } session.getPersistenceContextInternal().addUninitializedDetachedCollection( - session.getFactory().getCollectionPersister( getRole() ), + session.getFactory().getMetamodel().collectionPersister(getRole()), this ); } @@ -480,7 +480,7 @@ public abstract class AbstractPersistentCollection implements Serializable, P * Replace entity instances with copy in {@code copyCache}/. * * @param copyCache - mapping from entity in the process of being - * merged to managed copy. + * merged to managed copy. */ public final void replaceQueuedOperationValues(CollectionPersister persister, Map copyCache) { for ( DelayedOperation operation : operationQueue ) { @@ -1214,7 +1214,7 @@ public abstract class AbstractPersistentCollection implements Serializable, P return oldElements; } - final EntityPersister entityPersister = session.getFactory().getEntityPersister( entityName ); + final EntityPersister entityPersister = session.getFactory().getMetamodel().entityPersister(entityName); final Type idType = entityPersister.getIdentifierType(); final boolean useIdDirect = mayUseIdDirect( idType ); @@ -1281,7 +1281,7 @@ public abstract class AbstractPersistentCollection implements Serializable, P SharedSessionContractImplementor session) { if ( entityInstance != null && ForeignKeys.isNotTransient( entityName, entityInstance, null, session ) ) { - final EntityPersister entityPersister = session.getFactory().getEntityPersister( entityName ); + final EntityPersister entityPersister = session.getFactory().getMetamodel().entityPersister(entityName); final Type idType = entityPersister.getIdentifierType(); final Object idOfCurrent = ForeignKeys.getEntityIdentifierIfNotUnsaved( entityName, entityInstance, session ); @@ -1306,7 +1306,7 @@ public abstract class AbstractPersistentCollection implements Serializable, P * @param session The session * * @deprecated {@link #identityRemove(Collection, Object, String, SharedSessionContractImplementor)} - * should be used instead. + * should be used instead. */ @Deprecated public static void identityRemove( diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticReadUpdateLockingStrategy.java b/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticReadUpdateLockingStrategy.java index f67f056854..dc120d7ee2 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticReadUpdateLockingStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticReadUpdateLockingStrategy.java @@ -121,7 +121,7 @@ public class PessimisticReadUpdateLockingStrategy implements LockingStrategy { protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); - final Update update = new Update( factory.getJdbcServices().getDialect() ); + final Update update = new Update( factory.getJdbcServices().getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteUpdateLockingStrategy.java b/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteUpdateLockingStrategy.java index a622acdafa..b936b2f180 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteUpdateLockingStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteUpdateLockingStrategy.java @@ -119,7 +119,7 @@ public class PessimisticWriteUpdateLockingStrategy implements LockingStrategy { protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); - final Update update = new Update( factory.getJdbcServices().getDialect() ); + final Update update = new Update( factory.getJdbcServices().getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java b/hibernate-core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java index c3b51f829a..34fbecbdea 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java @@ -123,7 +123,7 @@ public class UpdateLockingStrategy implements LockingStrategy { protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); - final Update update = new Update( factory.getJdbcServices().getDialect() ); + final Update update = new Update( factory.getJdbcServices().getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/AbstractEntityEntry.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/AbstractEntityEntry.java index 9c0d68819d..5b4f9ef258 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/AbstractEntityEntry.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/AbstractEntityEntry.java @@ -108,7 +108,6 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry { /** * This for is used during custom deserialization handling */ - @SuppressWarnings( {"JavaDoc"}) protected AbstractEntityEntry( final SessionFactoryImplementor factory, final String entityName, @@ -122,7 +121,7 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry { final boolean existsInDatabase, final boolean isBeingReplicated, final PersistenceContext persistenceContext) { - this.persister = ( factory == null ? null : factory.getEntityPersister( entityName ) ); + this.persister = ( factory == null ? null : factory.getMetamodel().entityPersister(entityName)); this.id = id; setCompressedValue( EnumState.STATUS, status ); setCompressedValue( EnumState.PREVIOUS_STATUS, previousStatus ); @@ -328,10 +327,7 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry { final PersistentAttributeInterceptor interceptor = interceptable.$$_hibernate_getInterceptor(); if ( interceptor instanceof EnhancementAsProxyLazinessInterceptor ) { EnhancementAsProxyLazinessInterceptor enhancementAsProxyLazinessInterceptor = (EnhancementAsProxyLazinessInterceptor) interceptor; - if ( enhancementAsProxyLazinessInterceptor.hasWrittenFieldNames() ) { - return false; - } - return true; + return !enhancementAsProxyLazinessInterceptor.hasWrittenFieldNames(); } } else if ( entity instanceof HibernateProxy ) { @@ -472,10 +468,10 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry { * Saves the value for the given enum property. * * @param state - * identifies the value to store + * identifies the value to store * @param value - * the value to store; The caller must make sure that it matches - * the given identifier + * the value to store; The caller must make sure that it matches + * the given identifier */ protected > void setCompressedValue(EnumState state, E value) { // reset the bits for the given property to 0 @@ -488,7 +484,7 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry { * Gets the current value of the given enum property. * * @param state - * identifies the value to store + * identifies the value to store * @return the current value of the specified property */ protected > E getCompressedValue(EnumState state) { @@ -501,9 +497,9 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry { * Saves the value for the given boolean flag. * * @param state - * identifies the value to store + * identifies the value to store * @param value - * the value to store + * the value to store */ protected void setCompressedValue(BooleanState state, boolean value) { compressedState &= state.getUnsetMask(); @@ -514,7 +510,7 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry { * Gets the current value of the given boolean flag. * * @param state - * identifies the value to store + * identifies the value to store * @return the current value of the specified flag */ protected boolean getCompressedValue(BooleanState state) { @@ -607,7 +603,7 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry { private final int mask; private final int unsetMask; - private BooleanState(int offset) { + BooleanState(int offset) { this.offset = offset; this.mask = 0x1 << offset; this.unsetMask = 0xFFFF & ~mask; diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/Cascade.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/Cascade.java index 5a23bd42e1..82a69bbcfd 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/Cascade.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/Cascade.java @@ -460,7 +460,7 @@ public final class Cascade { final CascadeStyle style, final Object anything, final CollectionType type) { - final CollectionPersister persister = eventSource.getFactory().getCollectionPersister( type.getRole() ); + final CollectionPersister persister = eventSource.getFactory().getMetamodel().collectionPersister(type.getRole()); final Type elemType = persister.getElementType(); CascadePoint elementsCascadePoint = cascadePoint; diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/NonBatchingBatch.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/NonBatchingBatch.java index 9b290befa9..67d75ba878 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/NonBatchingBatch.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/NonBatchingBatch.java @@ -13,9 +13,6 @@ import java.util.Map; import org.hibernate.JDBCException; import org.hibernate.engine.jdbc.batch.spi.BatchKey; import org.hibernate.engine.jdbc.spi.JdbcCoordinator; -import org.hibernate.internal.CoreMessageLogger; - -import org.jboss.logging.Logger; /** * An implementation of {@link org.hibernate.engine.jdbc.batch.spi.Batch} which does not perform batching. It simply @@ -24,12 +21,8 @@ import org.jboss.logging.Logger; * @author Steve Ebersole */ public class NonBatchingBatch extends AbstractBatchImpl { - private static final CoreMessageLogger LOG = Logger.getMessageLogger( - CoreMessageLogger.class, - NonBatchingBatch.class.getName() - ); - private JdbcCoordinator jdbcCoordinator; + private final JdbcCoordinator jdbcCoordinator; protected NonBatchingBatch(BatchKey key, JdbcCoordinator jdbcCoordinator) { super( key, jdbcCoordinator ); @@ -45,7 +38,7 @@ public class NonBatchingBatch extends AbstractBatchImpl { final PreparedStatement statement = entry.getValue(); final int rowCount = jdbcCoordinator.getResultSetReturn().executeUpdate( statement ); getKey().getExpectation().verifyOutcome( rowCount, statement, 0, statementSQL ); - jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( statement ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( statement ); jdbcCoordinator.afterStatementExecution(); } catch ( SQLException e ) { diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java index 0984368429..9e46bbac59 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java @@ -274,11 +274,11 @@ public class JdbcCoordinatorImpl implements JdbcCoordinator { } private void releaseResources() { - getLogicalConnection().getResourceRegistry().releaseResources(); + getLogicalConnection().getResourceRegistry().releaseResources(); } private boolean hasRegisteredResources() { - return getLogicalConnection().getResourceRegistry().hasRegisteredResources(); + return getLogicalConnection().getResourceRegistry().hasRegisteredResources(); } private ConnectionReleaseMode determineConnectionReleaseMode( diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/ResultSetReturnImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/ResultSetReturnImpl.java index 2394ba014d..c42f720fa7 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/ResultSetReturnImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/ResultSetReturnImpl.java @@ -227,7 +227,7 @@ public class ResultSetReturnImpl implements ResultSetReturn { private void postExtract(ResultSet rs, Statement st) { if ( rs != null ) { - jdbcCoordinator.getLogicalConnection().getResourceRegistry().register( rs, st ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().register( rs, st ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/CollectionKey.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/CollectionKey.java index d45486149a..0916429254 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/CollectionKey.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/CollectionKey.java @@ -67,7 +67,7 @@ public final class CollectionKey implements Serializable { @Override public String toString() { return "CollectionKey" - + MessageHelper.collectionInfoString( factory.getCollectionPersister( role ), key, factory ); + + MessageHelper.collectionInfoString(factory.getMetamodel().collectionPersister(role), key, factory ); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/EntityKey.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/EntityKey.java index 0274269938..15e77a7c06 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/EntityKey.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/EntityKey.java @@ -149,7 +149,7 @@ public final class EntityKey implements Serializable { public static EntityKey deserialize(ObjectInputStream ois, SessionFactoryImplementor sessionFactory) throws IOException, ClassNotFoundException { final Object id = ois.readObject(); final String entityName = (String) ois.readObject(); - final EntityPersister entityPersister = sessionFactory.getEntityPersister( entityName ); + final EntityPersister entityPersister = sessionFactory.getMetamodel().entityPersister(entityName); return new EntityKey(id, entityPersister); } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java index 6dc650ed87..b334509858 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java @@ -1065,11 +1065,6 @@ public class SessionDelegatorBaseImpl implements SessionImplementor { delegate.addEventListeners( listeners ); } - @Override - public boolean isFlushBeforeCompletionEnabled() { - return delegate.isFlushBeforeCompletionEnabled(); - } - @Override public ActionQueue getActionQueue() { return delegate.getActionQueue(); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryDelegatingImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryDelegatingImpl.java index 063efe1f7e..125f3031fa 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryDelegatingImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryDelegatingImpl.java @@ -25,7 +25,6 @@ import org.hibernate.StatelessSessionBuilder; import org.hibernate.boot.model.relational.SqlStringGenerationContext; import org.hibernate.boot.spi.SessionFactoryOptions; import org.hibernate.cache.spi.CacheImplementor; -import org.hibernate.cfg.Settings; import org.hibernate.context.spi.CurrentTenantIdentifierResolver; import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.spi.JdbcServices; @@ -202,24 +201,24 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor, return delegate.getProperties(); } - @Override @Deprecated + @Deprecated public EntityPersister getEntityPersister(String entityName) throws MappingException { - return delegate.getEntityPersister( entityName ); + return delegate.getMetamodel().entityPersister(entityName); } - @Override @Deprecated + @Deprecated public Map getEntityPersisters() { - return delegate.getEntityPersisters(); + return delegate.getMetamodel().entityPersisters(); } - @Override @Deprecated + @Deprecated public CollectionPersister getCollectionPersister(String role) throws MappingException { - return delegate.getCollectionPersister( role ); + return delegate.getMetamodel().collectionPersister(role); } - @Override @Deprecated + @Deprecated public Map getCollectionPersisters() { - return delegate.getCollectionPersisters(); + return delegate.getMetamodel().collectionPersisters(); } @Override @@ -232,19 +231,14 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor, return delegate.getSqlStringGenerationContext(); } - @Override @Deprecated - public Dialect getDialect() { - return delegate.getJdbcServices().getDialect(); - } - - @Override @Deprecated + @Deprecated public String[] getImplementors(String className) throws MappingException { - return delegate.getImplementors( className ); + return delegate.getMetamodel().getImplementors(className); } - @Override @Deprecated + @Deprecated public String getImportedClassName(String name) { - return delegate.getImportedClassName( name ); + return delegate.getMetamodel().getImportedClassName(name); } @Override @@ -257,34 +251,14 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor, return delegate.bestGuessEntityName( object ); } - @Override @Deprecated - public StatisticsImplementor getStatisticsImplementor() { - return delegate.getStatistics(); - } - - @Override @Deprecated - public SQLExceptionConverter getSQLExceptionConverter() { - return delegate.getSQLExceptionConverter(); - } - - @Override @Deprecated - public SqlExceptionHelper getSQLExceptionHelper() { - return delegate.getJdbcServices().getSqlExceptionHelper(); - } - - @Override @Deprecated - public Settings getSettings() { - return delegate.getSettings(); - } - @Override public Session openTemporarySession() throws HibernateException { return delegate.openTemporarySession(); } - @Override @Deprecated + @Deprecated public Set getCollectionRolesByEntityParticipant(String entityName) { - return delegate.getCollectionRolesByEntityParticipant( entityName ); + return delegate.getMetamodel().getCollectionRolesByEntityParticipant(entityName); } @Override @@ -327,26 +301,11 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor, return delegate.getCurrentTenantIdentifierResolver(); } - @Override @Deprecated - public Iterable iterateEntityNameResolvers() { - return delegate.iterateEntityNameResolvers(); - } - @Override public FastSessionServices getFastSessionServices() { return delegate.getFastSessionServices(); } - @Override @Deprecated - public EntityPersister locateEntityPersister(Class byClass) { - return delegate.locateEntityPersister( byClass ); - } - - @Override @Deprecated - public EntityPersister locateEntityPersister(String byName) { - return delegate.locateEntityPersister( byName ); - } - @Override public DeserializationResolver getDeserializationResolver() { return delegate.getDeserializationResolver(); @@ -392,11 +351,6 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor, return delegate.getReference(); } - @Override - public List> findEntityGraphsByJavaType(Class entityClass) { - return delegate.findEntityGraphsByJavaType( entityClass ); - } - @Override public EntityManager createEntityManager() { return delegate.createEntityManager(); @@ -446,4 +400,9 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor, public WrapperOptions getWrapperOptions() { return delegate.getWrapperOptions(); } + + @Override + public List> findEntityGraphsByType(Class entityClass) { + return delegate.findEntityGraphsByType(entityClass); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java index ff80807c07..cdd7449cd1 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java @@ -7,37 +7,24 @@ package org.hibernate.engine.spi; import java.io.Serializable; -import java.util.List; -import java.util.Map; -import java.util.Set; -import jakarta.persistence.EntityGraph; import org.hibernate.CustomEntityDirtinessStrategy; -import org.hibernate.EntityNameResolver; import org.hibernate.HibernateException; -import org.hibernate.MappingException; -import org.hibernate.Metamodel; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.SessionFactoryObserver; import org.hibernate.boot.model.relational.SqlStringGenerationContext; import org.hibernate.cache.spi.CacheImplementor; -import org.hibernate.cfg.Settings; import org.hibernate.context.spi.CurrentTenantIdentifierResolver; -import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.spi.JdbcServices; -import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; import org.hibernate.engine.profile.FetchProfile; import org.hibernate.event.spi.EventEngine; -import org.hibernate.exception.spi.SQLExceptionConverter; import org.hibernate.graph.spi.RootGraphImplementor; import org.hibernate.id.IdentifierGenerator; import org.hibernate.metamodel.MappingMetamodel; import org.hibernate.metamodel.RuntimeMetamodels; import org.hibernate.internal.FastSessionServices; import org.hibernate.metamodel.spi.MetamodelImplementor; -import org.hibernate.persister.collection.CollectionPersister; -import org.hibernate.persister.entity.EntityPersister; import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.spi.QueryEngine; @@ -50,8 +37,8 @@ import org.hibernate.type.descriptor.WrapperOptions; import org.hibernate.type.spi.TypeConfiguration; /** - * Defines the internal contract between the {@code SessionFactory} and other parts of - * Hibernate such as implementors of {@code Type}. + * Defines the internal contract between the {@link SessionFactory} and the internal + * implementation of Hibernate. * * @see SessionFactory * @see org.hibernate.internal.SessionFactoryImpl @@ -62,8 +49,9 @@ import org.hibernate.type.spi.TypeConfiguration; public interface SessionFactoryImplementor extends Mapping, SessionFactory, SqmCreationContext, SqlAstCreationContext, QueryParameterBindingTypeResolver { /** - * Get the UUID for this SessionFactory. The value is generated as a {@link java.util.UUID}, but kept - * as a String. + * Get the UUID for this SessionFactory. + *

+ * The value is generated as a {@link java.util.UUID}, but kept as a String. * * @return The UUID for this SessionFactory. * @@ -150,14 +138,6 @@ public interface SessionFactoryImplementor */ CurrentTenantIdentifierResolver getCurrentTenantIdentifierResolver(); - /** - * @deprecated (since 5.2) use {@link #getMetamodel()} -> {@link MetamodelImplementor#getEntityNameResolvers()} - */ - @Deprecated - default Iterable iterateEntityNameResolvers() { - return getMetamodel().getEntityNameResolvers(); - } - /** * @return the FastSessionServices instance associated with this SessionFactory */ @@ -179,14 +159,6 @@ public interface SessionFactoryImplementor // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Deprecations - /** - * @deprecated (since 5.2) Just use {@link #getStatistics} (with covariant return here as {@link StatisticsImplementor}). - */ - @Deprecated - default StatisticsImplementor getStatisticsImplementor() { - return getStatistics(); - } - /** * Get the JdbcServices. * @@ -194,69 +166,16 @@ public interface SessionFactoryImplementor */ JdbcServices getJdbcServices(); - /** - * Get the SQL dialect. - *

- * Shorthand for {@code getJdbcServices().getDialect()} - * - * @return The dialect - * - * @deprecated (since 5.2) instead, use {@link JdbcServices#getDialect()} - */ - @Deprecated - default Dialect getDialect() { - return getJdbcServices().getDialect(); - } - SqlStringGenerationContext getSqlStringGenerationContext(); - /** - * Retrieves the SQLExceptionConverter in effect for this SessionFactory. - * - * @return The SQLExceptionConverter for this SessionFactory. - * - * @deprecated since 5.0; use {@link JdbcServices#getSqlExceptionHelper()} -> - * {@link SqlExceptionHelper#getSqlExceptionConverter()} instead as obtained from {@link #getServiceRegistry()} - */ - @Deprecated - default SQLExceptionConverter getSQLExceptionConverter() { - return getJdbcServices().getSqlExceptionHelper().getSqlExceptionConverter(); - } - - /** - * Retrieves the SqlExceptionHelper in effect for this SessionFactory. - * - * @return The SqlExceptionHelper for this SessionFactory. - * - * @deprecated since 5.0; use {@link JdbcServices#getSqlExceptionHelper()} instead as - * obtained from {@link #getServiceRegistry()} - */ - @Deprecated - default SqlExceptionHelper getSQLExceptionHelper() { - return getJdbcServices().getSqlExceptionHelper(); - } - - /** - * @deprecated since 5.0; use {@link #getSessionFactoryOptions()} instead - */ - @Deprecated - Settings getSettings(); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // map these to Metamodel - @Override MetamodelImplementor getMetamodel(); - @SuppressWarnings({ "unchecked", "rawtypes" }) - default List> findEntityGraphsByType(Class entityClass) { - return (List) findEntityGraphsByJavaType( entityClass ); - } - - List> findEntityGraphsByJavaType(Class entityClass); - RootGraphImplementor findEntityGraphByName(String name); /** @@ -264,84 +183,4 @@ public interface SessionFactoryImplementor */ String bestGuessEntityName(Object object); - /** - * @deprecated (since 5.2) Use {@link MetamodelImplementor#entityPersister(Class)} instead. - */ - @Deprecated - default EntityPersister getEntityPersister(String entityName) throws MappingException { - return getMetamodel().entityPersister( entityName ); - } - - /** - * @deprecated (since 5.2) Use {@link MetamodelImplementor#entityPersisters} instead. - */ - @Deprecated - default Map getEntityPersisters() { - return getMetamodel().entityPersisters(); - } - - /** - * @deprecated (since 5.2) Use {@link MetamodelImplementor#collectionPersister(String)} instead. - */ - @Deprecated - default CollectionPersister getCollectionPersister(String role) throws MappingException { - return getMetamodel().collectionPersister( role ); - } - - /** - * @deprecated (since 5.2) Use {@link MetamodelImplementor#collectionPersisters} instead. - */ - @Deprecated - default Map getCollectionPersisters() { - return getMetamodel().collectionPersisters(); - } - - /** - * @deprecated (since 5.2) Use {@link MetamodelImplementor#collectionPersisters} instead. - * Retrieves a set of all the collection roles in which the given entity - * is a participant, as either an index or an element. - * - * @param entityName The entity name for which to get the collection roles. - * @return set of all the collection roles in which the given entityName participates. - */ - @Deprecated - default Set getCollectionRolesByEntityParticipant(String entityName) { - return getMetamodel().getCollectionRolesByEntityParticipant( entityName ); - } - - /** - * @deprecated (since 5.2) Use {@link MetamodelImplementor#locateEntityPersister(Class)} instead. - */ - @Deprecated - default EntityPersister locateEntityPersister(Class byClass) { - return getMetamodel().locateEntityPersister( byClass ); - } - - /** - * @deprecated (since 5.2) Use {@link MetamodelImplementor#locateEntityPersister(String)} instead. - */ - @Deprecated - default EntityPersister locateEntityPersister(String byName) { - return getMetamodel().locateEntityPersister( byName ); - } - - /** - * Get the names of all persistent classes that implement/extend the given interface/class - * - * @deprecated Use {@link Metamodel#getImplementors(String)} instead - */ - @Deprecated - default String[] getImplementors(String entityName) { - return getMetamodel().getImplementors( entityName ); - } - - /** - * Get a class name, using query language imports - * - * @deprecated Use {@link Metamodel#getImportedClassName(String)} instead - */ - @Deprecated - default String getImportedClassName(String name) { - return getMetamodel().getImportedClassName( name ); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java index 5519560d92..54390133a3 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java @@ -17,31 +17,33 @@ import org.hibernate.resource.transaction.spi.TransactionCoordinator; import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder; /** - * Defines the "internal contract" for {@link Session} and other parts of Hibernate such as - * {@link org.hibernate.type.Type}, {@link EntityPersister} + * Defines the "internal contract" for {@link Session} and other parts of Hibernate such + * as {@link org.hibernate.type.Type}, {@link EntityPersister} * and {@link org.hibernate.persister.collection.CollectionPersister} implementations. * * A Session, through this interface and SharedSessionContractImplementor, implements: *

    *
  • - * {@link org.hibernate.resource.jdbc.spi.JdbcSessionOwner} to drive the behavior of the - * {@link org.hibernate.resource.jdbc.spi.JdbcSessionContext} delegate + * {@link org.hibernate.resource.jdbc.spi.JdbcSessionOwner} to drive the behavior + * of the {@link org.hibernate.resource.jdbc.spi.JdbcSessionContext} delegate *
  • *
  • * {@link TransactionCoordinatorBuilder.Options} * to drive the creation of the {@link TransactionCoordinator} delegate *
  • *
  • - * {@link org.hibernate.engine.jdbc.LobCreationContext} to act as the context for JDBC LOB instance creation + * {@link org.hibernate.engine.jdbc.LobCreationContext} to act as the context for + * JDBC LOB instance creation *
  • *
  • - * {@link org.hibernate.type.descriptor.WrapperOptions} to fulfill the behavior needed while - * binding/extracting values to/from JDBC as part of the Type contracts + * {@link org.hibernate.type.descriptor.WrapperOptions} to fulfill the behavior + * needed while binding/extracting values to/from JDBC as part of the {@code Type} + * contracts *
  • *
* - * See also {@link org.hibernate.event.spi.EventSource} which extends this interface providing - * bridge to the event generation features of {@link org.hibernate.event} + * See also {@link org.hibernate.event.spi.EventSource} which extends this interface + * providing s bridge to the event generation features of {@link org.hibernate.event}. * * @author Gavin King * @author Steve Ebersole @@ -65,13 +67,6 @@ public interface SessionImplementor extends Session, SharedSessionContractImplem @Override RootGraphImplementor getEntityGraph(String graphName); - - /** - * @deprecated (since 5.2) use {@link #getHibernateFlushMode()} instead. - */ - @Deprecated - boolean isFlushBeforeCompletionEnabled(); - ActionQueue getActionQueue(); Object instantiate(EntityPersister persister, Object id) throws HibernateException; @@ -79,37 +74,37 @@ public interface SessionImplementor extends Session, SharedSessionContractImplem void forceFlush(EntityEntry e) throws HibernateException; /** - * @deprecated OperationalContext should cover this overload I believe; Gail? + * @deprecated OperationalContext should cover this overload I believe */ @Deprecated void merge(String entityName, Object object, Map copiedAlready) throws HibernateException; /** - * @deprecated OperationalContext should cover this overload I believe; Gail? + * @deprecated OperationalContext should cover this overload I believe */ @Deprecated void persist(String entityName, Object object, Map createdAlready) throws HibernateException; /** - * @deprecated OperationalContext should cover this overload I believe; Gail? + * @deprecated OperationalContext should cover this overload I believe */ @Deprecated void persistOnFlush(String entityName, Object object, Map copiedAlready); /** - * @deprecated OperationalContext should cover this overload I believe; Gail? + * @deprecated OperationalContext should cover this overload I believe */ @Deprecated void refresh(String entityName, Object object, Map refreshedAlready) throws HibernateException; /** - * @deprecated OperationalContext should cover this overload I believe; Gail? + * @deprecated OperationalContext should cover this overload I believe */ @Deprecated void delete(String entityName, Object child, boolean isCascadeDeleteEnabled, Set transientEntities); /** - * @deprecated OperationalContext should cover this overload I believe; Gail? + * @deprecated OperationalContext should cover this overload I believe */ @Deprecated void removeOrphanBeforeUpdates(String entityName, Object child); diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultEvictEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultEvictEventListener.java index e9bbe4757e..7d7cf6844a 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultEvictEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultEvictEventListener.java @@ -56,7 +56,7 @@ public class DefaultEvictEventListener implements EvictEventListener { throw new IllegalArgumentException( "Could not determine identifier of proxy passed to evict()" ); } - final EntityPersister persister = source.getFactory().getEntityPersister( li.getEntityName() ); + final EntityPersister persister = source.getFactory().getMetamodel().entityPersister(li.getEntityName()); final EntityKey key = source.generateEntityKey( id, persister ); persistenceContext.removeProxy( key ); @@ -82,7 +82,7 @@ public class DefaultEvictEventListener implements EvictEventListener { final String entityName = persistenceContext.getSession().guessEntityName( object ); if ( entityName != null ) { try { - persister = persistenceContext.getSession().getFactory().getEntityPersister( entityName ); + persister = persistenceContext.getSession().getFactory().getMetamodel().entityPersister(entityName); } catch (Exception ignore) { } diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultPersistEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultPersistEventListener.java index a82b95aabf..c8943e7f7f 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultPersistEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultPersistEventListener.java @@ -52,7 +52,7 @@ public class DefaultPersistEventListener * */ public void onPersist(PersistEvent event) throws HibernateException { - onPersist( event, new IdentityHashMap( 10 ) ); + onPersist( event, new IdentityHashMap<>( 10 ) ); } /** @@ -103,8 +103,8 @@ public class DefaultPersistEventListener // entity state again. // NOTE: entityEntry must be null to get here, so we cannot use any of its values - EntityPersister persister = source.getFactory().getEntityPersister( entityName ); - if ( ForeignGenerator.class.isInstance( persister.getIdentifierGenerator() ) ) { + EntityPersister persister = source.getFactory().getMetamodel().entityPersister(entityName); + if ( persister.getIdentifierGenerator() instanceof ForeignGenerator ) { if ( LOG.isDebugEnabled() && persister.getIdentifier( entity, source ) != null ) { LOG.debug( "Resetting entity id attribute to null for foreign generator" ); } diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/OnLockVisitor.java b/hibernate-core/src/main/java/org/hibernate/event/internal/OnLockVisitor.java index d5e4aa4991..bf0a0052ab 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/OnLockVisitor.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/OnLockVisitor.java @@ -35,7 +35,7 @@ public class OnLockVisitor extends ReattachVisitor { } final SessionImplementor session = getSession(); - final CollectionPersister persister = session.getFactory().getCollectionPersister( type.getRole() ); + final CollectionPersister persister = session.getFactory().getMetamodel().collectionPersister(type.getRole()); if ( collection instanceof PersistentCollection ) { final PersistentCollection persistentCollection = (PersistentCollection) collection; diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/OnUpdateVisitor.java b/hibernate-core/src/main/java/org/hibernate/event/internal/OnUpdateVisitor.java index cf850eb111..3db4b9fe3d 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/OnUpdateVisitor.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/OnUpdateVisitor.java @@ -16,9 +16,9 @@ import org.hibernate.type.CollectionType; * When an entity is passed to update(), we must inspect all its collections and * 1. associate any uninitialized PersistentCollections with this session * 2. associate any initialized PersistentCollections with this session, using the - * existing snapshot + * existing snapshot * 3. execute a collection removal (SQL DELETE) for each null collection property - * or "new" collection + * or "new" collection * * @author Gavin King */ @@ -36,7 +36,7 @@ public class OnUpdateVisitor extends ReattachVisitor { } EventSource session = getSession(); - CollectionPersister persister = session.getFactory().getCollectionPersister( type.getRole() ); + CollectionPersister persister = session.getFactory().getMetamodel().collectionPersister(type.getRole()); final Object collectionKey = extractCollectionKeyFromOwner( persister ); if ( ( collection instanceof PersistentCollection ) ) { diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/ProxyVisitor.java b/hibernate-core/src/main/java/org/hibernate/event/internal/ProxyVisitor.java index 914ff4423c..cc6e75ac72 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/ProxyVisitor.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/ProxyVisitor.java @@ -61,8 +61,7 @@ public abstract class ProxyVisitor extends AbstractVisitor { throws HibernateException { final EventSource session = getSession(); if ( collection.wasInitialized() ) { - CollectionPersister collectionPersister = session.getFactory() - .getCollectionPersister( type.getRole() ); + CollectionPersister collectionPersister = session.getFactory().getMetamodel().collectionPersister(type.getRole()); session.getPersistenceContext() .addInitializedDetachedCollection( collectionPersister, collection ); } @@ -70,8 +69,7 @@ public abstract class ProxyVisitor extends AbstractVisitor { if ( !isCollectionSnapshotValid( collection ) ) { throw new HibernateException( "could not re-associate uninitialized transient collection" ); } - CollectionPersister collectionPersister = session.getFactory() - .getCollectionPersister( collection.getRole() ); + CollectionPersister collectionPersister = session.getFactory().getMetamodel().collectionPersister(collection.getRole()); session.getPersistenceContext() .addUninitializedDetachedCollection( collectionPersister, collection ); } diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/WrapVisitor.java b/hibernate-core/src/main/java/org/hibernate/event/internal/WrapVisitor.java index bf2e80165d..265bd5030e 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/WrapVisitor.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/WrapVisitor.java @@ -80,7 +80,7 @@ public class WrapVisitor extends ProxyVisitor { return null; } else { - CollectionPersister persister = session.getFactory().getCollectionPersister( collectionType.getRole() ); + CollectionPersister persister = session.getFactory().getMetamodel().collectionPersister(collectionType.getRole()); final PersistenceContext persistenceContext = session.getPersistenceContextInternal(); //TODO: move into collection type, so we can use polymorphism! diff --git a/hibernate-core/src/main/java/org/hibernate/internal/FilterConfiguration.java b/hibernate-core/src/main/java/org/hibernate/internal/FilterConfiguration.java index 55d5f6053c..6c8e7e45f9 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/FilterConfiguration.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/FilterConfiguration.java @@ -75,7 +75,7 @@ public class FilterConfiguration { } if ( aliasEntityMap != null ) { for ( Map.Entry entry : aliasEntityMap.entrySet() ) { - Joinable joinable = (Joinable) factory.getEntityPersister( entry.getValue() ); + Joinable joinable = (Joinable) factory.getMetamodel().entityPersister(entry.getValue()); ret.put( entry.getKey(), joinable.getTableName() ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java index 4d23c64c5d..72951cdfb8 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java @@ -607,18 +607,11 @@ public class SessionFactoryImpl implements SessionFactoryImplementor { ); } - @SuppressWarnings("deprecation") - public Settings getSettings() { - return settings; - } - @Override - public List> findEntityGraphsByJavaType(Class entityClass) { - return getMetamodel().findEntityGraphsByJavaType( entityClass ); + public List> findEntityGraphsByType(Class entityClass) { + return (List) getMetamodel().findEntityGraphsByJavaType( entityClass ); } - - // todo : (5.2) review synchronizationType, persistenceContextType, transactionType usage // SynchronizationType -> should we auto enlist in transactions @@ -708,7 +701,7 @@ public class SessionFactoryImpl implements SessionFactoryImplementor { } @Override - public RootGraphImplementor findEntityGraphByName(String name) { + public RootGraphImplementor findEntityGraphByName(String name) { return getMetamodel().findEntityGraphByName( name ); } @@ -1027,29 +1020,27 @@ public class SessionFactoryImpl implements SessionFactoryImplementor { } } - if ( "jta".equals( impl ) ) { + switch (impl) { + case "jta": // if ( ! transactionFactory().compatibleWithJtaSynchronization() ) { // LOG.autoFlushWillNotWork(); // } - return new JTASessionContext( this ); - } - else if ( "thread".equals( impl ) ) { - return new ThreadLocalSessionContext( this ); - } - else if ( "managed".equals( impl ) ) { - return new ManagedSessionContext( this ); - } - else { - try { - Class implClass = serviceRegistry.getService( ClassLoaderService.class ).classForName( impl ); - return (CurrentSessionContext) - implClass.getConstructor( new Class[] { SessionFactoryImplementor.class } ) - .newInstance( this ); - } - catch( Throwable t ) { - LOG.unableToConstructCurrentSessionContext( impl, t ); - return null; - } + return new JTASessionContext(this); + case "thread": + return new ThreadLocalSessionContext(this); + case "managed": + return new ManagedSessionContext(this); + default: + try { + Class implClass = serviceRegistry.getService(ClassLoaderService.class).classForName(impl); + return (CurrentSessionContext) + implClass.getConstructor( new Class[]{SessionFactoryImplementor.class} ) + .newInstance(this); + } + catch (Throwable t) { + LOG.unableToConstructCurrentSessionContext(impl, t); + return null; + } } } @@ -1149,7 +1140,7 @@ public class SessionFactoryImpl implements SessionFactoryImplementor { } else if ( statelessInterceptorImplementor != null ) { try { - /** + /* * We could remove the getStatelessInterceptorImplementor method and use just the getStatelessInterceptorImplementorSupplier * since it can cover both cases when the user has given a Supplier or just the * Class, in which case, we simply instantiate the Interceptor when calling the Supplier. @@ -1302,7 +1293,6 @@ public class SessionFactoryImpl implements SessionFactoryImplementor { } @Override - @SuppressWarnings("unchecked") public T owner(SessionOwner sessionOwner) { throw new UnsupportedOperationException( "SessionOwner was long deprecated and this method should no longer be invoked" ); } @@ -1418,7 +1408,7 @@ public class SessionFactoryImpl implements SessionFactoryImplementor { return (T) this; } - @Override + @Override @SuppressWarnings("unchecked") public T jdbcTimeZone(TimeZone timeZone) { jdbcTimeZone = timeZone; return (T) this; @@ -1684,6 +1674,6 @@ public class SessionFactoryImpl implements SessionFactoryImplementor { private enum Status { OPEN, CLOSING, - CLOSED; + CLOSED } } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java index afe02ea124..5a3efa3208 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java @@ -2190,11 +2190,6 @@ public class SessionImpl return status == TransactionStatus.ACTIVE || status == TransactionStatus.COMMITTING; } - @Override - public boolean isFlushBeforeCompletionEnabled() { - return getHibernateFlushMode() != FlushMode.MANUAL; - } - @Override public SessionImplementor getSession() { return this; diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/EntityPrinter.java b/hibernate-core/src/main/java/org/hibernate/internal/util/EntityPrinter.java index d14526edf9..29093bfeac 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/EntityPrinter.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/EntityPrinter.java @@ -39,7 +39,7 @@ public final class EntityPrinter { * @return the entity rendered to a string */ public String toString(String entityName, Object entity) throws HibernateException { - EntityPersister entityPersister = factory.getEntityPersister( entityName ); + EntityPersister entityPersister = factory.getMetamodel().entityPersister(entityName); if ( entityPersister == null || !entityPersister.isInstance( entity ) ) { return entity.getClass().getName(); diff --git a/hibernate-core/src/main/java/org/hibernate/loader/entity/CacheEntityLoaderHelper.java b/hibernate-core/src/main/java/org/hibernate/loader/entity/CacheEntityLoaderHelper.java index d5c67eb8e8..ee01ac673b 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/entity/CacheEntityLoaderHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/entity/CacheEntityLoaderHelper.java @@ -141,8 +141,7 @@ public class CacheEntityLoaderHelper { } if ( options.isAllowNulls() ) { final EntityPersister persister = event.getSession() - .getFactory() - .getEntityPersister( keyToLoad.getEntityName() ); + .getFactory().getMetamodel().entityPersister(keyToLoad.getEntityName()); if ( !persister.isInstance( old ) ) { LOG.debug( "Load request found matching entity in context, but the matched entity was of an inconsistent return type; returning null" @@ -366,7 +365,7 @@ public class CacheEntityLoaderHelper { final Object entity; - subclassPersister = factory.getEntityPersister( entry.getSubclass() ); + subclassPersister = factory.getMetamodel().entityPersister(entry.getSubclass()); entity = instanceToLoad == null ? source.instantiate( subclassPersister, entityId ) : instanceToLoad; diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java index deb12346e0..c854b969d9 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java @@ -276,7 +276,7 @@ public class OneToManyPersister extends AbstractCollectionPersister { } finally { if ( !useBatch ) { - session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st ); + session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st ); session.getJdbcCoordinator().afterStatementExecution(); } } @@ -389,7 +389,7 @@ public class OneToManyPersister extends AbstractCollectionPersister { } finally { if ( !useBatch ) { - session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st ); + session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st ); session.getJdbcCoordinator().afterStatementExecution(); } } @@ -461,7 +461,7 @@ public class OneToManyPersister extends AbstractCollectionPersister { } finally { if ( !useBatch ) { - session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st ); + session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st ); session.getJdbcCoordinator().afterStatementExecution(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/DiscriminatorType.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/DiscriminatorType.java index ad97843fb2..913f49383a 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/DiscriminatorType.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/DiscriminatorType.java @@ -134,7 +134,7 @@ public class DiscriminatorType extends AbstractType implements BasicType, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { String entityName = session.getFactory().getClassMetadata((Class) value).getEntityName(); - Loadable entityPersister = (Loadable) session.getFactory().getEntityPersister(entityName); + Loadable entityPersister = (Loadable) session.getFactory().getMetamodel().entityPersister(entityName); underlyingType.nullSafeSet(st, entityPersister.getDiscriminatorValue(), index, session); } @@ -142,7 +142,7 @@ public class DiscriminatorType extends AbstractType implements BasicType, public void bind(PreparedStatement st, T value, int index, WrapperOptions options) throws SQLException { final SessionFactoryImplementor factory = options.getSession().getFactory(); final String entityName = factory.getClassMetadata( (Class) value).getEntityName(); - final Loadable entityPersister = (Loadable) factory.getEntityPersister( entityName); + final Loadable entityPersister = (Loadable) factory.getMetamodel().entityPersister(entityName); underlyingType.getJdbcValueBinder().bind( st, entityPersister.getDiscriminatorValue(), index, options ); } @@ -150,7 +150,7 @@ public class DiscriminatorType extends AbstractType implements BasicType, public void bind(CallableStatement st, T value, String name, WrapperOptions options) throws SQLException { final SessionFactoryImplementor factory = options.getSession().getFactory(); final String entityName = factory.getClassMetadata( (Class) value).getEntityName(); - final Loadable entityPersister = (Loadable) factory.getEntityPersister( entityName); + final Loadable entityPersister = (Loadable) factory.getMetamodel().entityPersister(entityName); underlyingType.getJdbcValueBinder().bind( st, entityPersister.getDiscriminatorValue(), name, options ); } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java index 346f8ba177..2f2c8165a8 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java @@ -175,8 +175,8 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister { } else { final Column column = (Column) selectable; - explicitDiscriminatorColumnName = column.getQuotedName(factory.getJdbcServices().getDialect()); - discriminatorAlias = column.getAlias(factory.getJdbcServices().getDialect(), persistentClass.getRootTable() ); + explicitDiscriminatorColumnName = column.getQuotedName(factory.getJdbcServices().getDialect()); + discriminatorAlias = column.getAlias(factory.getJdbcServices().getDialect(), persistentClass.getRootTable() ); } discriminatorType = (BasicType) persistentClass.getDiscriminator().getType(); if ( persistentClass.isDiscriminatorValueNull() ) { @@ -646,16 +646,16 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister { *

* For the persister for JoinedEntity, we'd have: *

-	 *     subclassClosure[0] = "JoinedEntitySubSubclass"
-	 *     subclassClosure[1] = "JoinedEntitySubclass"
-	 *     subclassClosure[2] = "JoinedEntity"
+	 *	 subclassClosure[0] = "JoinedEntitySubSubclass"
+	 *	 subclassClosure[1] = "JoinedEntitySubclass"
+	 *	 subclassClosure[2] = "JoinedEntity"
 	 *
-	 *     subclassTableNameClosure[0] = "T_JoinedEntity"
-	 *     subclassTableNameClosure[1] = "T_JoinedEntitySubclass"
-	 *     subclassTableNameClosure[2] = "T_JoinedEntitySubSubclass"
+	 *	 subclassTableNameClosure[0] = "T_JoinedEntity"
+	 *	 subclassTableNameClosure[1] = "T_JoinedEntitySubclass"
+	 *	 subclassTableNameClosure[2] = "T_JoinedEntitySubSubclass"
 	 *
-	 *     subclassNameClosureBySubclassTable[0] = ["JoinedEntitySubSubclass", "JoinedEntitySubclass"]
-	 *     subclassNameClosureBySubclassTable[1] = ["JoinedEntitySubSubclass"]
+	 *	 subclassNameClosureBySubclassTable[0] = ["JoinedEntitySubSubclass", "JoinedEntitySubclass"]
+	 *	 subclassNameClosureBySubclassTable[1] = ["JoinedEntitySubSubclass"]
 	 * 
* Note that there are only 2 entries in subclassNameClosureBySubclassTable. That is because there are really only * 2 tables here that make up the subclass mapping, the others make up the class/superclass table mappings. We diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java b/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java index 14e0c8d661..e3ffcce828 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java @@ -135,7 +135,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer { session = s; if ( readOnlyBeforeAttachedToSession == null ) { // use the default read-only/modifiable setting - final EntityPersister persister = s.getFactory().getEntityPersister( entityName ); + final EntityPersister persister = s.getFactory().getMetamodel().entityPersister(entityName); setReadOnly( s.getPersistenceContext().isDefaultReadOnly() || !persister.isMutable() ); } else { @@ -151,7 +151,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer { if ( id == null || s == null || entityName == null ) { return null; } - return s.generateEntityKey( id, s.getFactory().getEntityPersister( entityName ) ); + return s.generateEntityKey( id, s.getFactory().getMetamodel().entityPersister(entityName)); } @Override @@ -371,7 +371,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer { errorIfReadOnlySettingNotAvailable(); // only update if readOnly is different from current setting if ( this.readOnly != readOnly ) { - final EntityPersister persister = session.getFactory().getEntityPersister( entityName ); + final EntityPersister persister = session.getFactory().getMetamodel().entityPersister(entityName); if ( !persister.isMutable() && !readOnly ) { throw new IllegalStateException( "cannot make proxies [" + entityName + "#" + id + "] for immutable entities modifiable" ); } @@ -394,8 +394,8 @@ public abstract class AbstractLazyInitializer implements LazyInitializer { * is not available (i.e., isReadOnlySettingAvailable() == false) * * @return null, if the default setting should be used; - * true, for read-only; - * false, for modifiable + * true, for read-only; + * false, for modifiable * * @throws IllegalStateException if isReadOnlySettingAvailable() == true */ diff --git a/hibernate-core/src/main/java/org/hibernate/query/sql/internal/ResultSetMappingProcessor.java b/hibernate-core/src/main/java/org/hibernate/query/sql/internal/ResultSetMappingProcessor.java index 60e6c63060..7e540c4f1c 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sql/internal/ResultSetMappingProcessor.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sql/internal/ResultSetMappingProcessor.java @@ -384,7 +384,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext { } private SQLLoadable getSQLLoadable(String entityName) throws MappingException { - EntityPersister persister = factory.getEntityPersister( entityName ); + EntityPersister persister = factory.getMetamodel().entityPersister(entityName); if ( !(persister instanceof SQLLoadable) ) { throw new MappingException( "class persister is not SQLLoadable: " + entityName ); } @@ -450,7 +450,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext { } private void addCollection(String role, String alias, Map propertyResults) { - SQLLoadableCollection collectionPersister = ( SQLLoadableCollection ) factory.getCollectionPersister( role ); + SQLLoadableCollection collectionPersister = ( SQLLoadableCollection ) factory.getMetamodel().collectionPersister(role); alias2CollectionPersister.put( alias, collectionPersister ); String suffix = generateCollectionSuffix(); LOG.tracev( "Mapping alias [{0}] to collection-suffix [{1}]", alias, suffix ); diff --git a/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java b/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java index 750aa88ffb..b4baba4b79 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java @@ -469,7 +469,7 @@ public abstract class CollectionType extends AbstractType implements Association @Override public Joinable getAssociatedJoinable(SessionFactoryImplementor factory) throws MappingException { - return (Joinable) factory.getCollectionPersister( role ); + return (Joinable) factory.getMetamodel().collectionPersister(role); } @Override @@ -482,8 +482,7 @@ public abstract class CollectionType extends AbstractType implements Association throws MappingException { try { - QueryableCollection collectionPersister = (QueryableCollection) factory - .getCollectionPersister( role ); + QueryableCollection collectionPersister = (QueryableCollection) factory.getMetamodel().collectionPersister(role); if ( !collectionPersister.getElementType().isEntityType() ) { throw new MappingException( @@ -716,7 +715,7 @@ public abstract class CollectionType extends AbstractType implements Association * @throws MappingException Indicates the underlying persister could not be located. */ public final Type getElementType(SessionFactoryImplementor factory) throws MappingException { - return factory.getCollectionPersister( getRole() ).getElementType(); + return factory.getMetamodel().collectionPersister(getRole()).getElementType(); } @Override diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entitynonentity/EntityNonEntityTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entitynonentity/EntityNonEntityTest.java index dd86beaf21..96c6f0a622 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entitynonentity/EntityNonEntityTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entitynonentity/EntityNonEntityTest.java @@ -52,14 +52,14 @@ public class EntityNonEntityTest extends BaseCoreFunctionalTestCase { @TestForIssue( jiraKey = "HHH-9856" ) public void testGetAndFindNonEntityThrowsIllegalArgumentException() { try { - sessionFactory().locateEntityPersister( Cellular.class ); - } + sessionFactory().getMetamodel().locateEntityPersister(Cellular.class); + } catch (UnknownEntityTypeException ignore) { // expected } try { - sessionFactory().locateEntityPersister( Cellular.class.getName() ); + sessionFactory().getMetamodel().locateEntityPersister(Cellular.class.getName()); } catch (UnknownEntityTypeException ignore) { // expected diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/enumerated/mappedSuperclass/EnumeratedWithMappedSuperclassTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/enumerated/mappedSuperclass/EnumeratedWithMappedSuperclassTest.java index ae9e944734..8180caa7bb 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/enumerated/mappedSuperclass/EnumeratedWithMappedSuperclassTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/enumerated/mappedSuperclass/EnumeratedWithMappedSuperclassTest.java @@ -77,7 +77,7 @@ public class EnumeratedWithMappedSuperclassTest extends BaseUnitTestCase { SessionFactoryImplementor sf = (SessionFactoryImplementor) metadata.buildSessionFactory(); try { - EntityPersister p = sf.getEntityPersister( AddressLevel.class.getName() ); + EntityPersister p = sf.getMetamodel().entityPersister(AddressLevel.class.getName()); CustomType runtimeType = assertTyping( CustomType.class, p.getPropertyType( "nature" ) ); EnumType runtimeEnumType = assertTyping( EnumType.class, runtimeType.getUserType() ); assertEquals( Types.VARCHAR, runtimeEnumType.sqlTypes()[0] ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generationmappings/NewGeneratorMappingsTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generationmappings/NewGeneratorMappingsTest.java index 121d4f905c..09931c8095 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generationmappings/NewGeneratorMappingsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generationmappings/NewGeneratorMappingsTest.java @@ -56,7 +56,7 @@ public class NewGeneratorMappingsTest { @Test public void testMinimalSequenceEntity(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( MinimalSequenceEntity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(MinimalSequenceEntity.class.getName()); IdentifierGenerator generator = persister.getIdentifierGenerator(); assertTrue( SequenceStyleGenerator.class.isInstance( generator ) ); SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator; @@ -71,7 +71,7 @@ public class NewGeneratorMappingsTest { @Test public void testCompleteSequenceEntity(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( CompleteSequenceEntity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(CompleteSequenceEntity.class.getName()); IdentifierGenerator generator = persister.getIdentifierGenerator(); assertTrue( SequenceStyleGenerator.class.isInstance( generator ) ); SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator; @@ -82,7 +82,7 @@ public class NewGeneratorMappingsTest { @Test public void testAutoEntity(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( AutoEntity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(AutoEntity.class.getName()); IdentifierGenerator generator = persister.getIdentifierGenerator(); assertTrue( SequenceStyleGenerator.class.isInstance( generator ) ); SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator; @@ -93,7 +93,7 @@ public class NewGeneratorMappingsTest { @Test public void testTablePerClassAutoEntity(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( AbstractTPCAutoEntity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(AbstractTPCAutoEntity.class.getName()); IdentifierGenerator generator = persister.getIdentifierGenerator(); assertTrue( SequenceStyleGenerator.class.isInstance( generator ) ); SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator; @@ -105,7 +105,7 @@ public class NewGeneratorMappingsTest { @Test public void testMinimalTableEntity(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( MinimalTableEntity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(MinimalTableEntity.class.getName()); IdentifierGenerator generator = persister.getIdentifierGenerator(); assertTrue( TableGenerator.class.isInstance( generator ) ); TableGenerator tabGenerator = (TableGenerator) generator; @@ -124,7 +124,7 @@ public class NewGeneratorMappingsTest { @TestForIssue(jiraKey = "HHH-6790") public void testSequencePerEntity(SessionFactoryScope scope) { // Checking first entity. - EntityPersister persister = scope.getSessionFactory().getEntityPersister( DedicatedSequenceEntity1.class.getName() ); + EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(DedicatedSequenceEntity1.class.getName()); IdentifierGenerator generator = persister.getIdentifierGenerator(); assertTrue( SequenceStyleGenerator.class.isInstance( generator ) ); SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator; @@ -134,7 +134,7 @@ public class NewGeneratorMappingsTest { ); // Checking second entity. - persister = scope.getSessionFactory().getEntityPersister( DedicatedSequenceEntity2.class.getName() ); + persister = scope.getSessionFactory().getMetamodel().entityPersister(DedicatedSequenceEntity2.class.getName()); generator = persister.getIdentifierGenerator(); assertTrue( SequenceStyleGenerator.class.isInstance( generator ) ); seqGenerator = (SequenceStyleGenerator) generator; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/sequences/HibernateSequenceTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/sequences/HibernateSequenceTest.java index 9d23c00b40..ee9784c4b0 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/sequences/HibernateSequenceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/sequences/HibernateSequenceTest.java @@ -41,8 +41,7 @@ public class HibernateSequenceTest { @Test public void testHibernateSequenceSchema(SessionFactoryScope scope) { - EntityPersister persister = scope.getSessionFactory() - .getEntityPersister( HibernateSequenceEntity.class.getName() ); + EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(HibernateSequenceEntity.class.getName()); IdentifierGenerator generator = persister.getIdentifierGenerator(); assertTrue( SequenceStyleGenerator.class.isInstance( generator ) ); SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/lob/MaterializedBlobTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/lob/MaterializedBlobTest.java index d6c35d447c..877c5d92fd 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/lob/MaterializedBlobTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/lob/MaterializedBlobTest.java @@ -33,8 +33,8 @@ public class MaterializedBlobTest extends BaseCoreFunctionalTestCase { @Test public void testTypeSelection() { - int index = sessionFactory().getEntityPersister( MaterializedBlobEntity.class.getName() ).getEntityMetamodel().getPropertyIndex( "theBytes" ); - BasicType type = (BasicType) sessionFactory().getEntityPersister( MaterializedBlobEntity.class.getName() ).getEntityMetamodel().getProperties()[index].getType(); + int index = sessionFactory().getMetamodel().entityPersister(MaterializedBlobEntity.class.getName()).getEntityMetamodel().getPropertyIndex( "theBytes" ); + BasicType type = (BasicType) sessionFactory().getMetamodel().entityPersister(MaterializedBlobEntity.class.getName()).getEntityMetamodel().getProperties()[index].getType(); assertTrue( type.getJavaTypeDescriptor() instanceof PrimitiveByteArrayJavaType ); assertTrue( type.getJdbcType() instanceof BlobJdbcType ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetomany/OrderByTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetomany/OrderByTest.java index 0be6537c4b..ab37e62868 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetomany/OrderByTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetomany/OrderByTest.java @@ -275,8 +275,7 @@ public class OrderByTest extends BaseCoreFunctionalTestCase { @Test @TestForIssue(jiraKey = "HHH-5732") public void testInverseIndex() { - final CollectionPersister transactionsPersister = sessionFactory().getCollectionPersister( - BankAccount.class.getName() + ".transactions" ); + final CollectionPersister transactionsPersister = sessionFactory().getMetamodel().collectionPersister(BankAccount.class.getName() + ".transactions"); assertTrue( transactionsPersister.isInverse() ); Session s = openSession(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/boot/database/qualfiedTableNaming/QualifiedTableNamingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/boot/database/qualfiedTableNaming/QualifiedTableNamingTest.java index 78cc51772b..30f381e3ab 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/boot/database/qualfiedTableNaming/QualifiedTableNamingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/boot/database/qualfiedTableNaming/QualifiedTableNamingTest.java @@ -73,7 +73,7 @@ public class QualifiedTableNamingTest extends BaseNonConfigCoreFunctionalTestCas assertNotNull( expectedName ); - SingleTableEntityPersister persister = (SingleTableEntityPersister) sessionFactory().getEntityPersister( Box.class.getName() ); + SingleTableEntityPersister persister = (SingleTableEntityPersister) sessionFactory().getMetamodel().entityPersister(Box.class.getName()); assertEquals( expectedName, persister.getTableName() ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/access/jpa/AccessMappingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/access/jpa/AccessMappingTest.java index b710208337..034b8f9f22 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/access/jpa/AccessMappingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/access/jpa/AccessMappingTest.java @@ -12,20 +12,6 @@ import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.metamodel.mapping.internal.BasicEntityIdentifierMappingImpl; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.Animal; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.Being; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.Course1; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.Course2; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.Course3; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.Course4; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.Course5; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.Course6; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.Course7; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.Course8; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.Horse; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.Person; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.Student; -import org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa.User; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.property.access.spi.GetterFieldImpl; import org.hibernate.property.access.spi.GetterMethodImpl; @@ -90,7 +76,7 @@ public class AccessMappingTest { cfg.addAnnotatedClass( Student.class ); SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry ); try { - final EntityPersister entityPersister = factory.getEntityPersister( classUnderTest.getName() ); + final EntityPersister entityPersister = factory.getMetamodel().entityPersister(classUnderTest.getName()); final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping(); assertTrue( @@ -111,7 +97,7 @@ public class AccessMappingTest { cfg.addAnnotatedClass( Student.class ); SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry ); try { - final EntityPersister entityPersister = factory.getEntityPersister( classUnderTest.getName() ); + final EntityPersister entityPersister = factory.getMetamodel().entityPersister(classUnderTest.getName()); final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping(); assertTrue( @@ -132,7 +118,7 @@ public class AccessMappingTest { cfg.addAnnotatedClass( Student.class ); SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry ); try { - final EntityPersister entityPersister = factory.getEntityPersister( classUnderTest.getName() ); + final EntityPersister entityPersister = factory.getMetamodel().entityPersister(classUnderTest.getName()); final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping(); assertTrue( @@ -173,7 +159,7 @@ public class AccessMappingTest { cfg.addAnnotatedClass( Student.class ); SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry ); try { - final EntityPersister entityPersister = factory.getEntityPersister( classUnderTest.getName() ); + final EntityPersister entityPersister = factory.getMetamodel().entityPersister(classUnderTest.getName()); final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping(); assertTrue( @@ -199,7 +185,7 @@ public class AccessMappingTest { cfg.addAnnotatedClass( Student.class ); SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry ); try { - final EntityPersister entityPersister = factory.getEntityPersister( classUnderTest.getName() ); + final EntityPersister entityPersister = factory.getMetamodel().entityPersister(classUnderTest.getName()); final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping(); assertTrue( @@ -226,7 +212,7 @@ public class AccessMappingTest { cfg.addAnnotatedClass( Being.class ); SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry ); try { - final EntityPersister entityPersister = factory.getEntityPersister( classUnderTest.getName() ); + final EntityPersister entityPersister = factory.getMetamodel().entityPersister(classUnderTest.getName()); final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping(); assertTrue( @@ -247,7 +233,7 @@ public class AccessMappingTest { SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry ); try { - EntityPersister entityPersister = factory.getEntityPersister( Animal.class.getName() ); + EntityPersister entityPersister = factory.getMetamodel().entityPersister(Animal.class.getName()); final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping(); assertTrue( @@ -255,7 +241,7 @@ public class AccessMappingTest { identifierMapping.getPropertyAccess().getGetter() instanceof GetterMethodImpl ); - entityPersister = factory.getEntityPersister( Horse.class.getName() ); + entityPersister = factory.getMetamodel().entityPersister(Horse.class.getName()); assertTrue( "Field access should be used since the default access mode gets inherited", diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/cache/CollectionCacheEvictionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/cache/CollectionCacheEvictionTest.java index d62de81b0b..54a8150fed 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/cache/CollectionCacheEvictionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/cache/CollectionCacheEvictionTest.java @@ -89,7 +89,7 @@ public class CollectionCacheEvictionTest extends BaseCoreFunctionalTestCase { @Test public void testCachedValueAfterEviction() { - CollectionPersister persister = sessionFactory().getCollectionPersister( Company.class.getName() + ".users" ); + CollectionPersister persister = sessionFactory().getMetamodel().collectionPersister(Company.class.getName() + ".users"); Session session = openSession(); SessionImplementor sessionImplementor = (SessionImplementor) session; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/UnversionedCascadeDereferencedCollectionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/UnversionedCascadeDereferencedCollectionTest.java index 4abe367706..ebecf52609 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/UnversionedCascadeDereferencedCollectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/UnversionedCascadeDereferencedCollectionTest.java @@ -96,8 +96,8 @@ public class UnversionedCascadeDereferencedCollectionTest extends AbstractDerefe CollectionEntry ceManiesOrig = getCollectionEntry( session, maniesEEOneStateOrig ); assertNotNull( ceManiesOrig ); assertEquals( role, ceManiesOrig.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManiesOrig.getLoadedPersister() ); assertEquals( one.getId(), ceManiesOrig.getKey() ); @@ -177,8 +177,8 @@ public class UnversionedCascadeDereferencedCollectionTest extends AbstractDerefe CollectionEntry ceManies = getCollectionEntry( session, maniesEEOneStateOrig ); assertNotNull( ceManies ); assertEquals( role, ceManies.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManies.getLoadedPersister() ); assertEquals( one.getId(), ceManies.getKey() ); @@ -261,8 +261,8 @@ public class UnversionedCascadeDereferencedCollectionTest extends AbstractDerefe CollectionEntry ceManiesOrig = getCollectionEntry( session, maniesEEOneStateOrig ); assertNotNull( ceManiesOrig ); assertEquals( role, ceManiesOrig.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManiesOrig.getLoadedPersister() ); assertEquals( one.getId(), ceManiesOrig.getKey() ); @@ -304,8 +304,8 @@ public class UnversionedCascadeDereferencedCollectionTest extends AbstractDerefe ); assertNotNull( ceManiesAfterReplace ); assertEquals( role, ceManiesAfterReplace.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManiesAfterReplace.getLoadedPersister() ); assertEquals( one.getId(), ceManiesAfterReplace.getKey() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/UnversionedNoCascadeDereferencedCollectionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/UnversionedNoCascadeDereferencedCollectionTest.java index 4f001c49a3..bf2dbf28cd 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/UnversionedNoCascadeDereferencedCollectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/UnversionedNoCascadeDereferencedCollectionTest.java @@ -94,8 +94,8 @@ public class UnversionedNoCascadeDereferencedCollectionTest extends AbstractDere CollectionEntry ceManiesOrig = getCollectionEntry( session, maniesEEOneStateOrig ); assertNotNull( ceManiesOrig ); assertEquals( role, ceManiesOrig.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManiesOrig.getLoadedPersister() ); assertEquals( one.getId(), ceManiesOrig.getKey() ); @@ -174,8 +174,8 @@ public class UnversionedNoCascadeDereferencedCollectionTest extends AbstractDere CollectionEntry ceManies = getCollectionEntry( session, maniesEEOneStateOrig ); assertNotNull( ceManies ); assertEquals( role, ceManies.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManies.getLoadedPersister() ); assertEquals( one.getId(), ceManies.getKey() ); @@ -257,8 +257,8 @@ public class UnversionedNoCascadeDereferencedCollectionTest extends AbstractDere CollectionEntry ceManiesOrig = getCollectionEntry( session, maniesEEOneStateOrig ); assertNotNull( ceManiesOrig ); assertEquals( role, ceManiesOrig.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManiesOrig.getLoadedPersister() ); assertEquals( one.getId(), ceManiesOrig.getKey() ); @@ -300,8 +300,8 @@ public class UnversionedNoCascadeDereferencedCollectionTest extends AbstractDere ); assertNotNull( ceManiesAfterReplace ); assertEquals( role, ceManiesAfterReplace.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManiesAfterReplace.getLoadedPersister() ); assertEquals( one.getId(), ceManiesAfterReplace.getKey() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/VersionedCascadeDereferencedCollectionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/VersionedCascadeDereferencedCollectionTest.java index f2ac657459..39e3c17fb8 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/VersionedCascadeDereferencedCollectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/VersionedCascadeDereferencedCollectionTest.java @@ -96,8 +96,8 @@ public class VersionedCascadeDereferencedCollectionTest extends AbstractDerefere CollectionEntry ceManiesOrig = getCollectionEntry( session, maniesEEOneStateOrig ); assertNotNull( ceManiesOrig ); assertEquals( role, ceManiesOrig.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManiesOrig.getLoadedPersister() ); assertEquals( one.getId(), ceManiesOrig.getKey() ); @@ -174,8 +174,8 @@ public class VersionedCascadeDereferencedCollectionTest extends AbstractDerefere CollectionEntry ceManies = getCollectionEntry( session, maniesEEOneStateOrig ); assertNotNull( ceManies ); assertEquals( role, ceManies.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManies.getLoadedPersister() ); assertEquals( one.getId(), ceManies.getKey() ); @@ -254,8 +254,8 @@ public class VersionedCascadeDereferencedCollectionTest extends AbstractDerefere CollectionEntry ceManiesOrig = getCollectionEntry( session, maniesEEOneStateOrig ); assertNotNull( ceManiesOrig ); assertEquals( role, ceManiesOrig.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManiesOrig.getLoadedPersister() ); assertEquals( one.getId(), ceManiesOrig.getKey() ); @@ -297,8 +297,8 @@ public class VersionedCascadeDereferencedCollectionTest extends AbstractDerefere ); assertNotNull( ceManiesAfterReplace ); assertEquals( role, ceManiesAfterReplace.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManiesAfterReplace.getLoadedPersister() ); assertEquals( one.getId(), ceManiesAfterReplace.getKey() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/VersionedNoCascadeDereferencedCollectionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/VersionedNoCascadeDereferencedCollectionTest.java index 9f4d2b4a07..7db5768427 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/VersionedNoCascadeDereferencedCollectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/VersionedNoCascadeDereferencedCollectionTest.java @@ -96,8 +96,8 @@ public class VersionedNoCascadeDereferencedCollectionTest extends AbstractDerefe CollectionEntry ceManiesOrig = getCollectionEntry( session, maniesEEOneStateOrig ); assertNotNull( ceManiesOrig ); assertEquals( role, ceManiesOrig.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManiesOrig.getLoadedPersister() ); assertEquals( one.getId(), ceManiesOrig.getKey() ); @@ -176,8 +176,8 @@ public class VersionedNoCascadeDereferencedCollectionTest extends AbstractDerefe CollectionEntry ceManies = getCollectionEntry( session, maniesEEOneStateOrig ); assertNotNull( ceManies ); assertEquals( role, ceManies.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManies.getLoadedPersister() ); assertEquals( one.getId(), ceManies.getKey() ); @@ -260,8 +260,8 @@ public class VersionedNoCascadeDereferencedCollectionTest extends AbstractDerefe CollectionEntry ceManiesOrig = getCollectionEntry( session, maniesEEOneStateOrig ); assertNotNull( ceManiesOrig ); assertEquals( role, ceManiesOrig.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManiesOrig.getLoadedPersister() ); assertEquals( one.getId(), ceManiesOrig.getKey() ); @@ -303,8 +303,8 @@ public class VersionedNoCascadeDereferencedCollectionTest extends AbstractDerefe ); assertNotNull( ceManiesAfterReplace ); assertEquals( role, ceManiesAfterReplace.getRole() ); - assertSame( - scope.getSessionFactory().getCollectionPersister( role ), + assertSame( + scope.getSessionFactory().getMetamodel().collectionPersister(role), ceManiesAfterReplace.getLoadedPersister() ); assertEquals( one.getId(), ceManiesAfterReplace.getKey() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/list/PersistentListTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/list/PersistentListTest.java index b5e165b4a7..392b54ffa4 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/list/PersistentListTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/list/PersistentListTest.java @@ -45,8 +45,7 @@ public class PersistentListTest { public void testInverseListIndex(SessionFactoryScope scope) { // make sure no one changes the mapping SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); - final CollectionPersister collectionPersister = sessionFactory - .getCollectionPersister( ListOwner.class.getName() + ".children" ); + final CollectionPersister collectionPersister = sessionFactory.getMetamodel().collectionPersister(ListOwner.class.getName() + ".children"); assertTrue( collectionPersister.isInverse() ); // do some creations... @@ -110,8 +109,7 @@ public class PersistentListTest { public void testInverseListIndex2(SessionFactoryScope scope) { // make sure no one changes the mapping SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); - final CollectionPersister collectionPersister = sessionFactory - .getCollectionPersister( Order.class.getName() + ".lineItems" ); + final CollectionPersister collectionPersister = sessionFactory.getMetamodel().collectionPersister(Order.class.getName() + ".lineItems"); assertTrue( collectionPersister.isInverse() ); // do some creations... diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/BatchFetchStrategyHelperTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/BatchFetchStrategyHelperTest.java index d3acb6a2e2..6f651b28df 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/BatchFetchStrategyHelperTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/BatchFetchStrategyHelperTest.java @@ -172,13 +172,13 @@ public class BatchFetchStrategyHelperTest extends BaseCoreFunctionalTestCase { } private org.hibernate.FetchMode determineFetchMode(Class entityClass, String path) { - OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getEntityPersister( entityClass.getName() ); + OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getMetamodel().entityPersister(entityClass.getName()); int index = ( (UniqueKeyLoadable) entityPersister ).getPropertyIndex( path ); return entityPersister.getFetchMode( index ); } private AssociationType determineAssociationType(Class entityClass, String path) { - OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getEntityPersister( entityClass.getName() ); + OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getMetamodel().entityPersister(entityClass.getName()); int index = ( (UniqueKeyLoadable) entityPersister ).getPropertyIndex( path ); return (AssociationType) entityPersister.getSubclassPropertyType( index ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/FetchStrategyHelperTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/FetchStrategyHelperTest.java index bb23820dce..0d049138dd 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/FetchStrategyHelperTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/FetchStrategyHelperTest.java @@ -168,13 +168,13 @@ public class FetchStrategyHelperTest extends BaseCoreFunctionalTestCase { } private org.hibernate.FetchMode determineFetchMode(Class entityClass, String path) { - OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getEntityPersister( entityClass.getName() ); + OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getMetamodel().entityPersister(entityClass.getName()); int index = ( (UniqueKeyLoadable) entityPersister ).getPropertyIndex( path ); return entityPersister.getFetchMode( index ); } private AssociationType determineAssociationType(Class entityClass, String path) { - OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getEntityPersister( entityClass.getName() ); + OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getMetamodel().entityPersister(entityClass.getName()); int index = ( (UniqueKeyLoadable) entityPersister ).getPropertyIndex( path ); return (AssociationType) entityPersister.getSubclassPropertyType( index ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/NoProxyFetchStrategyHelperTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/NoProxyFetchStrategyHelperTest.java index 0d55f5d528..8378c6073e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/NoProxyFetchStrategyHelperTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/NoProxyFetchStrategyHelperTest.java @@ -90,13 +90,13 @@ public class NoProxyFetchStrategyHelperTest extends BaseCoreFunctionalTestCase { } private org.hibernate.FetchMode determineFetchMode(Class entityClass, String path) { - OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getEntityPersister( entityClass.getName() ); + OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getMetamodel().entityPersister(entityClass.getName()); int index = ( (UniqueKeyLoadable) entityPersister ).getPropertyIndex( path ); return entityPersister.getFetchMode( index ); } private AssociationType determineAssociationType(Class entityClass, String path) { - OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getEntityPersister( entityClass.getName() ); + OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getMetamodel().entityPersister(entityClass.getName()); int index = ( (UniqueKeyLoadable) entityPersister ).getPropertyIndex( path ); return (AssociationType) entityPersister.getSubclassPropertyType( index ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/filter/DynamicFilterTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/filter/DynamicFilterTest.java index 4b485872d9..1141283359 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/filter/DynamicFilterTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/filter/DynamicFilterTest.java @@ -106,7 +106,7 @@ public class DynamicFilterTest extends BaseNonConfigCoreFunctionalTestCase { @Test public void testSecondLevelCachedCollectionsFiltering() { - CollectionPersister persister = sessionFactory().getCollectionPersister( Salesperson.class.getName() + ".orders" ); + CollectionPersister persister = sessionFactory().getMetamodel().collectionPersister(Salesperson.class.getName() + ".orders"); CollectionDataAccess cache = persister.getCacheAccessStrategy(); CollectionCacheEntry cachedData = fromSession( diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/hql/BulkManipulationTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/hql/BulkManipulationTest.java index c01c80e74a..49ff3b73c7 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/hql/BulkManipulationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/hql/BulkManipulationTest.java @@ -523,7 +523,7 @@ public class BulkManipulationTest extends BaseCoreFunctionalTestCase { } protected boolean supportsBulkInsertIdGeneration(Class entityClass) { - EntityPersister persister = sessionFactory().getEntityPersister( entityClass.getName() ); + EntityPersister persister = sessionFactory().getMetamodel().entityPersister(entityClass.getName()); IdentifierGenerator generator = persister.getIdentifierGenerator(); return BulkInsertionCapableIdentifierGenerator.class.isInstance( generator ) && BulkInsertionCapableIdentifierGenerator.class.cast( generator ) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/forcedtable/BasicForcedTableSequenceTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/forcedtable/BasicForcedTableSequenceTest.java index 05f50102a5..657aaf4839 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/forcedtable/BasicForcedTableSequenceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/forcedtable/BasicForcedTableSequenceTest.java @@ -7,7 +7,6 @@ package org.hibernate.orm.test.idgen.enhanced.forcedtable; -import org.hibernate.Session; import org.hibernate.id.IdentifierGeneratorHelper.BasicHolder; import org.hibernate.id.enhanced.NoopOptimizer; import org.hibernate.id.enhanced.SequenceStyleGenerator; @@ -34,7 +33,7 @@ public class BasicForcedTableSequenceTest { @Test public void testNormalBoundary(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( Entity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(Entity.class.getName()); assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) ); final SequenceStyleGenerator generator = ( SequenceStyleGenerator ) persister.getIdentifierGenerator(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/forcedtable/HiLoForcedTableSequenceTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/forcedtable/HiLoForcedTableSequenceTest.java index 5486c529f6..89a04f8a06 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/forcedtable/HiLoForcedTableSequenceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/forcedtable/HiLoForcedTableSequenceTest.java @@ -30,7 +30,7 @@ public class HiLoForcedTableSequenceTest { @Test public void testNormalBoundary(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( Entity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(Entity.class.getName()); assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) ); final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/forcedtable/PooledForcedTableSequenceTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/forcedtable/PooledForcedTableSequenceTest.java index 6ad69a14f3..c1255d6228 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/forcedtable/PooledForcedTableSequenceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/forcedtable/PooledForcedTableSequenceTest.java @@ -30,7 +30,7 @@ public class PooledForcedTableSequenceTest { @Test public void testNormalBoundary(SessionFactoryScope scope) { - EntityPersister persister = scope.getSessionFactory().getEntityPersister( Entity.class.getName() ); + EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(Entity.class.getName()); assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) ); final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/BasicSequenceTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/BasicSequenceTest.java index 19610d413c..e651e495ac 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/BasicSequenceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/BasicSequenceTest.java @@ -6,7 +6,6 @@ */ package org.hibernate.orm.test.idgen.enhanced.sequence; -import org.hibernate.Session; import org.hibernate.id.IdentifierGeneratorHelper.BasicHolder; import org.hibernate.id.enhanced.SequenceStyleGenerator; import org.hibernate.persister.entity.EntityPersister; @@ -20,7 +19,6 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import static org.hamcrest.Matchers.instanceOf; -import static org.hibernate.testing.junit4.ExtraAssertions.assertClassAssignability; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; @@ -39,7 +37,7 @@ public class BasicSequenceTest { @Test public void testNormalBoundary(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( Entity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(Entity.class.getName()); assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) ); final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator(); @@ -68,7 +66,7 @@ public class BasicSequenceTest { public void testSequencePerEntity(SessionFactoryScope scope) { final String overriddenEntityName = "SpecialEntity"; - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( overriddenEntityName ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(overriddenEntityName); assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) ); final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/HiLoSequenceMismatchStrategyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/HiLoSequenceMismatchStrategyTest.java index 73bcf757f8..d8cfd9bcd4 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/HiLoSequenceMismatchStrategyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/HiLoSequenceMismatchStrategyTest.java @@ -17,7 +17,6 @@ import jakarta.persistence.Id; import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.Parameter; import org.hibernate.cfg.AvailableSettings; -import org.hibernate.dialect.DerbyDialect; import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.id.enhanced.HiLoOptimizer; @@ -94,7 +93,7 @@ public class HiLoSequenceMismatchStrategyTest { @Test public void testSequenceMismatchStrategyNotApplied(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( TestEntity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(TestEntity.class.getName()); assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) ); final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/HiLoSequenceTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/HiLoSequenceTest.java index 7c849ebb05..7fc1d2c1d4 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/HiLoSequenceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/HiLoSequenceTest.java @@ -31,7 +31,7 @@ public class HiLoSequenceTest { @Test public void testNormalBoundary(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( Entity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(Entity.class.getName()); assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) ); final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/PooledSequenceTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/PooledSequenceTest.java index 7024a59418..afa982bc19 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/PooledSequenceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/sequence/PooledSequenceTest.java @@ -30,7 +30,7 @@ public class PooledSequenceTest { @Test public void testNormalBoundary(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( Entity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(Entity.class.getName()); assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) ); final SequenceStyleGenerator generator = ( SequenceStyleGenerator ) persister.getIdentifierGenerator(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/table/BasicTableTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/table/BasicTableTest.java index 0d058478fb..48f2ca2242 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/table/BasicTableTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/table/BasicTableTest.java @@ -26,7 +26,7 @@ public class BasicTableTest { @Test public void testNormalBoundary(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( Entity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(Entity.class.getName()); assertThat( persister.getIdentifierGenerator(), instanceOf( TableGenerator.class ) ); final TableGenerator generator = ( TableGenerator ) persister.getIdentifierGenerator(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/table/HiLoTableTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/table/HiLoTableTest.java index 2cd065bc1e..51008533d3 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/table/HiLoTableTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/table/HiLoTableTest.java @@ -26,7 +26,7 @@ import static org.junit.Assert.assertThat; public class HiLoTableTest { @Test public void testNormalBoundary(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( Entity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(Entity.class.getName()); assertThat( persister.getIdentifierGenerator(), instanceOf( TableGenerator.class ) ); final TableGenerator generator = (TableGenerator) persister.getIdentifierGenerator(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/table/PooledTableTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/table/PooledTableTest.java index 26dbd9772a..d3599aef3d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/table/PooledTableTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/enhanced/table/PooledTableTest.java @@ -26,7 +26,7 @@ import static org.junit.Assert.assertThat; public class PooledTableTest { @Test public void testNormalBoundary(SessionFactoryScope scope) { - final EntityPersister persister = scope.getSessionFactory().getEntityPersister( Entity.class.getName() ); + final EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(Entity.class.getName()); assertThat( persister.getIdentifierGenerator(), instanceOf( TableGenerator.class ) ); final TableGenerator generator = (TableGenerator) persister.getIdentifierGenerator(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/AbstractEntityWithManyToManyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/AbstractEntityWithManyToManyTest.java index 3a684ac967..8242cfc9b8 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/AbstractEntityWithManyToManyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/AbstractEntityWithManyToManyTest.java @@ -56,8 +56,8 @@ public abstract class AbstractEntityWithManyToManyTest { catch (IllegalArgumentException ex) { isPlanContractsBidirectional = false; } - isPlanVersioned = sessionFactory.getEntityPersister( Plan.class.getName() ).isVersioned(); - isContractVersioned = sessionFactory.getEntityPersister( Contract.class.getName() ).isVersioned(); + isPlanVersioned = sessionFactory.getMetamodel().entityPersister(Plan.class.getName()).isVersioned(); + isContractVersioned = sessionFactory.getMetamodel().entityPersister(Contract.class.getName()).isVersioned(); sessionFactory.getStatistics().clear(); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/joinedsubclass/JoinedSubclassWithExplicitDiscriminatorTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/joinedsubclass/JoinedSubclassWithExplicitDiscriminatorTest.java index 5be6158df4..490e91210f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/joinedsubclass/JoinedSubclassWithExplicitDiscriminatorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/joinedsubclass/JoinedSubclassWithExplicitDiscriminatorTest.java @@ -45,14 +45,14 @@ public class JoinedSubclassWithExplicitDiscriminatorTest { @Test public void metadataAssertions(SessionFactoryScope scope) { - EntityPersister p = scope.getSessionFactory().getEntityPersister( Dog.class.getName() ); + EntityPersister p = scope.getSessionFactory().getMetamodel().entityPersister(Dog.class.getName()); assertNotNull( p ); final JoinedSubclassEntityPersister dogPersister = assertTyping( JoinedSubclassEntityPersister.class, p ); assertEquals( "string", dogPersister.getDiscriminatorType().getName() ); assertEquals( "type", dogPersister.getDiscriminatorColumnName() ); assertEquals( "dog", dogPersister.getDiscriminatorValue() ); - p = scope.getSessionFactory().getEntityPersister( Cat.class.getName() ); + p = scope.getSessionFactory().getMetamodel().entityPersister(Cat.class.getName()); assertNotNull( p ); final JoinedSubclassEntityPersister catPersister = assertTyping( JoinedSubclassEntityPersister.class, p ); assertEquals( "string", catPersister.getDiscriminatorType().getName() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/joinedsubclass/JoinedSubclassWithIgnoredExplicitDiscriminatorTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/joinedsubclass/JoinedSubclassWithIgnoredExplicitDiscriminatorTest.java index 79e26aacf8..87e96e185e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/joinedsubclass/JoinedSubclassWithIgnoredExplicitDiscriminatorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/joinedsubclass/JoinedSubclassWithIgnoredExplicitDiscriminatorTest.java @@ -54,14 +54,14 @@ public class JoinedSubclassWithIgnoredExplicitDiscriminatorTest { @Test public void metadataAssertions(SessionFactoryScope scope) { - EntityPersister p = scope.getSessionFactory().getEntityPersister( Dog.class.getName() ); + EntityPersister p = scope.getSessionFactory().getMetamodel().entityPersister(Dog.class.getName()); assertNotNull( p ); final JoinedSubclassEntityPersister dogPersister = assertTyping( JoinedSubclassEntityPersister.class, p ); assertEquals( "integer", dogPersister.getDiscriminatorType().getName() ); assertEquals( "clazz_", dogPersister.getDiscriminatorColumnName() ); assertTrue( Integer.class.isInstance( dogPersister.getDiscriminatorValue() ) ); - p = scope.getSessionFactory().getEntityPersister( Cat.class.getName() ); + p = scope.getSessionFactory().getMetamodel().entityPersister(Cat.class.getName()); assertNotNull( p ); final JoinedSubclassEntityPersister catPersister = assertTyping( JoinedSubclassEntityPersister.class, p ); assertEquals( "integer", catPersister.getDiscriminatorType().getName() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/joinedsubclass/JoinedSubclassWithImplicitDiscriminatorTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/joinedsubclass/JoinedSubclassWithImplicitDiscriminatorTest.java index b6437d1de2..86a65e0631 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/joinedsubclass/JoinedSubclassWithImplicitDiscriminatorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/joinedsubclass/JoinedSubclassWithImplicitDiscriminatorTest.java @@ -50,7 +50,7 @@ public class JoinedSubclassWithImplicitDiscriminatorTest { @Test public void metadataAssertions(SessionFactoryScope scope) { - EntityPersister p = scope.getSessionFactory().getEntityPersister( Dog.class.getName() ); + EntityPersister p = scope.getSessionFactory().getMetamodel().entityPersister(Dog.class.getName()); assertNotNull( p ); final JoinedSubclassEntityPersister dogPersister = assertTyping( JoinedSubclassEntityPersister.class, p ); assertEquals( @@ -63,7 +63,7 @@ public class JoinedSubclassWithImplicitDiscriminatorTest { ); assertEquals( "Dog", dogPersister.getDiscriminatorValue() ); - p = scope.getSessionFactory().getEntityPersister( Cat.class.getName() ); + p = scope.getSessionFactory().getMetamodel().entityPersister(Cat.class.getName()); assertNotNull( p ); final JoinedSubclassEntityPersister catPersister = assertTyping( JoinedSubclassEntityPersister.class, p ); assertEquals( diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/BasicJodaTimeConversionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/BasicJodaTimeConversionTest.java index 9aa903e1a7..3d2ec3a811 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/BasicJodaTimeConversionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/BasicJodaTimeConversionTest.java @@ -75,7 +75,7 @@ public class BasicJodaTimeConversionTest extends BaseNonConfigCoreFunctionalTest @Test public void testSimpleConvertUsage() throws MalformedURLException { - final EntityPersister ep = sessionFactory().getEntityPersister( TheEntity.class.getName() ); + final EntityPersister ep = sessionFactory().getMetamodel().entityPersister(TheEntity.class.getName()); final Type theDatePropertyType = ep.getPropertyType( "theDate" ); final AttributeConverterTypeAdapter type = assertTyping( AttributeConverterTypeAdapter.class, theDatePropertyType ); assertTrue( JodaLocalDateConverter.class.isAssignableFrom( type.getAttributeConverter().getConverterJavaType().getJavaTypeClass() ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/DirtyCheckingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/DirtyCheckingTest.java index ee7972b3a2..5ef3cac787 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/DirtyCheckingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/DirtyCheckingTest.java @@ -115,7 +115,7 @@ public class DirtyCheckingTest extends BaseNonConfigCoreFunctionalTestCase { @Test public void checkConverterMutabilityPlans() { - final EntityPersister persister = sessionFactory().getEntityPersister( SomeEntity.class.getName() ); + final EntityPersister persister = sessionFactory().getMetamodel().entityPersister(SomeEntity.class.getName()); final AttributeMapping numberMapping = persister.findAttributeMapping( "number" ); final AttributeMapping nameMapping = persister.findAttributeMapping( "name" ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitDateConvertersTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitDateConvertersTest.java index 85a8bcd182..8ade0921b5 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitDateConvertersTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitDateConvertersTest.java @@ -80,7 +80,7 @@ public class ExplicitDateConvertersTest extends BaseNonConfigCoreFunctionalTestC @Test public void testSimpleConvertUsage() throws MalformedURLException { - final EntityPersister ep = sessionFactory().getEntityPersister( Entity1.class.getName() ); + final EntityPersister ep = sessionFactory().getMetamodel().entityPersister(Entity1.class.getName()); final Type theDatePropertyType = ep.getPropertyType( "theDate" ); final AttributeConverterTypeAdapter type = assertTyping( AttributeConverterTypeAdapter.class, diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitEnumConvertersTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitEnumConvertersTest.java index 237d606001..f851afb643 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitEnumConvertersTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitEnumConvertersTest.java @@ -88,7 +88,7 @@ public class ExplicitEnumConvertersTest extends BaseNonConfigCoreFunctionalTestC @Test public void testSimpleConvertUsage() throws MalformedURLException { - final EntityPersister ep = sessionFactory().getEntityPersister( Entity1.class.getName() ); + final EntityPersister ep = sessionFactory().getMetamodel().entityPersister(Entity1.class.getName()); final Type theDatePropertyType = ep.getPropertyType( "mediaType" ); final AttributeConverterTypeAdapter type = assertTyping( AttributeConverterTypeAdapter.class, diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java index 9d806cb3b4..2ad92f59c1 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java @@ -39,7 +39,7 @@ public class SimpleConvertAnnotationTest extends BaseNonConfigCoreFunctionalTest @Test public void testSimpleConvertUsage() throws MalformedURLException { - final EntityPersister ep = sessionFactory().getEntityPersister( Entity1.class.getName() ); + final EntityPersister ep = sessionFactory().getMetamodel().entityPersister(Entity1.class.getName()); final Type websitePropertyType = ep.getPropertyType( "website" ); final AttributeConverterTypeAdapter type = assertTyping( AttributeConverterTypeAdapter.class, diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java index 877627c48f..ec567af4bf 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java @@ -40,7 +40,7 @@ public class SimpleConvertsAnnotationTest extends BaseNonConfigCoreFunctionalTes @Test public void testSimpleConvertsUsage() throws MalformedURLException { - final EntityPersister ep = sessionFactory().getEntityPersister( Entity1.class.getName() ); + final EntityPersister ep = sessionFactory().getMetamodel().entityPersister(Entity1.class.getName()); final Type websitePropertyType = ep.getPropertyType( "website" ); final AttributeConverterTypeAdapter type = assertTyping( AttributeConverterTypeAdapter.class, diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleEmbeddableOverriddenConverterTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleEmbeddableOverriddenConverterTest.java index ff5e484a8b..601a4539d1 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleEmbeddableOverriddenConverterTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleEmbeddableOverriddenConverterTest.java @@ -47,7 +47,7 @@ public class SimpleEmbeddableOverriddenConverterTest extends BaseNonConfigCoreFu */ @Test public void testSimpleConvertOverrides() { - final EntityPersister ep = sessionFactory().getEntityPersister( Person.class.getName() ); + final EntityPersister ep = sessionFactory().getMetamodel().entityPersister(Person.class.getName()); final JdbcTypeRegistry jdbcTypeRegistry = sessionFactory().getTypeConfiguration() .getJdbcTypeRegistry(); CompositeType homeAddressType = assertTyping( CompositeType.class, ep.getPropertyType( "homeAddress" ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleOverriddenConverterTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleOverriddenConverterTest.java index 808b3480cf..2e8d2ad512 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleOverriddenConverterTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleOverriddenConverterTest.java @@ -44,7 +44,7 @@ public class SimpleOverriddenConverterTest extends BaseNonConfigCoreFunctionalTe */ @Test public void testSimpleConvertOverrides() { - final EntityPersister ep = sessionFactory().getEntityPersister( Sub.class.getName() ); + final EntityPersister ep = sessionFactory().getMetamodel().entityPersister(Sub.class.getName()); final JdbcTypeRegistry jdbcTypeRegistry = sessionFactory().getTypeConfiguration() .getJdbcTypeRegistry(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java index 59e2f11f14..42c0ee4c42 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java @@ -97,7 +97,7 @@ public class XmlWithExplicitConvertAnnotationsTest extends BaseNonConfigCoreFunc @Test public void testSimpleConvertUsage() throws MalformedURLException { - final EntityPersister ep = sessionFactory().getEntityPersister( Entity1.class.getName() ); + final EntityPersister ep = sessionFactory().getMetamodel().entityPersister(Entity1.class.getName()); final Type theDatePropertyType = ep.getPropertyType( "theDate" ); final AttributeConverterTypeAdapter type = assertTyping( AttributeConverterTypeAdapter.class, diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/ondemandload/cache/CacheLazyLoadNoTransTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/ondemandload/cache/CacheLazyLoadNoTransTest.java index 365d74ac46..0e3574dc19 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/ondemandload/cache/CacheLazyLoadNoTransTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/ondemandload/cache/CacheLazyLoadNoTransTest.java @@ -162,7 +162,7 @@ public class CacheLazyLoadNoTransTest { Object value = scope.fromSession( session -> { final SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); - CollectionPersister persister = sessionFactory.getCollectionPersister( entityClass.getName() + "." + attr ); + CollectionPersister persister = sessionFactory.getMetamodel().collectionPersister(entityClass.getName() + "." + attr); CollectionDataAccess cache = persister.getCacheAccessStrategy(); Object key = cache.generateCacheKey( id, persister, sessionFactory, session.getTenantIdentifier() ); Object cachedValue = cache.get( session, key ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/persister/entity/CustomSqlSchemaResolvingIdentityTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/persister/entity/CustomSqlSchemaResolvingIdentityTest.java index f96816936c..5e9c81d977 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/persister/entity/CustomSqlSchemaResolvingIdentityTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/persister/entity/CustomSqlSchemaResolvingIdentityTest.java @@ -48,8 +48,8 @@ public class CustomSqlSchemaResolvingIdentityTest { public void testSchemaNotReplacedInCustomSQL(SessionFactoryScope scope) throws Exception { String className = CustomEntity.class.getName(); - - final AbstractEntityPersister persister = (AbstractEntityPersister) scope.getSessionFactory().getEntityPersister( className ); + + final AbstractEntityPersister persister = (AbstractEntityPersister) scope.getSessionFactory().getMetamodel().entityPersister(className); String insertQuery = persister.getSQLInsertStrings()[0]; String updateQuery = persister.getSQLUpdateStrings()[0]; String deleteQuery = persister.getSQLDeleteStrings()[0]; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/persister/entity/CustomSqlSchemaResolvingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/persister/entity/CustomSqlSchemaResolvingTest.java index 336273b3a4..c65ff2b68e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/persister/entity/CustomSqlSchemaResolvingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/persister/entity/CustomSqlSchemaResolvingTest.java @@ -43,7 +43,7 @@ public class CustomSqlSchemaResolvingTest { String className = CustomEntity.class.getName(); - final AbstractEntityPersister persister = (AbstractEntityPersister) scope.getSessionFactory().getEntityPersister( className ); + final AbstractEntityPersister persister = (AbstractEntityPersister) scope.getSessionFactory().getMetamodel().entityPersister(className); String insertQuery = persister.getSQLInsertStrings()[0]; String updateQuery = persister.getSQLUpdateStrings()[0]; String deleteQuery = persister.getSQLDeleteStrings()[0]; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/proxy/ProxyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/proxy/ProxyTest.java index e446483566..330ef110ca 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/proxy/ProxyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/proxy/ProxyTest.java @@ -483,9 +483,9 @@ public class ProxyTest extends BaseCoreFunctionalTestCase { s.delete( container ); // force a snapshot retrieval of the proxied container SessionImpl sImpl = ( SessionImpl ) s; - sImpl.getPersistenceContext().getDatabaseSnapshot( + sImpl.getPersistenceContext().getDatabaseSnapshot( lastContainerId, - sImpl.getFactory().getEntityPersister( Container.class.getName() ) + sImpl.getFactory().getMetamodel().entityPersister(Container.class.getName()) ); assertFalse( Hibernate.isInitialized( proxy ) ); t.commit(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/version/sybase/SybaseTimestampComparisonAnnotationsTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/version/sybase/SybaseTimestampComparisonAnnotationsTest.java index 480000d3c7..9209d75a4d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/version/sybase/SybaseTimestampComparisonAnnotationsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/version/sybase/SybaseTimestampComparisonAnnotationsTest.java @@ -39,8 +39,8 @@ public class SybaseTimestampComparisonAnnotationsTest extends BaseCoreFunctional @Test @TestForIssue( jiraKey = "HHH-10413" ) public void testComparableTimestamps() { - final BasicType versionType = - sessionFactory().getEntityPersister( Thing.class.getName() ).getVersionType(); + final BasicType versionType = + sessionFactory().getMetamodel().entityPersister(Thing.class.getName()).getVersionType(); assertTrue( versionType.getJavaTypeDescriptor() instanceof PrimitiveByteArrayJavaType ); assertTrue( versionType.getJdbcType() instanceof VarbinaryJdbcType ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/version/sybase/SybaseTimestampVersioningTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/version/sybase/SybaseTimestampVersioningTest.java index f42a4129ed..7f610a5c35 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/version/sybase/SybaseTimestampVersioningTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/version/sybase/SybaseTimestampVersioningTest.java @@ -234,8 +234,8 @@ public class SybaseTimestampVersioningTest extends BaseCoreFunctionalTestCase { @Test @TestForIssue( jiraKey = "HHH-10413" ) public void testComparableTimestamps() { - final BasicType versionType = - sessionFactory().getEntityPersister( User.class.getName() ).getVersionType(); + final BasicType versionType = + sessionFactory().getMetamodel().entityPersister(User.class.getName()).getVersionType(); assertTrue( versionType.getJavaTypeDescriptor() instanceof PrimitiveByteArrayJavaType ); assertTrue( versionType.getJdbcType() instanceof VarbinaryJdbcType ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/tm/CMTTest.java b/hibernate-core/src/test/java/org/hibernate/test/tm/CMTTest.java index a64bed7978..92e3d8219f 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/tm/CMTTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/tm/CMTTest.java @@ -66,7 +66,7 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase { assertEquals( 0, sessionFactory().getStatistics().getUpdateTimestampsCacheHitCount() ); assertEquals( 0, sessionFactory().getStatistics().getUpdateTimestampsCachePutCount() ); assertEquals( 0, sessionFactory().getStatistics().getUpdateTimestampsCacheMissCount() ); - assertNotNull( sessionFactory().getEntityPersister( "Item" ).getCacheAccessStrategy() ); + assertNotNull( sessionFactory().getMetamodel().entityPersister("Item").getCacheAccessStrategy() ); assertEquals( 0, sessionFactory().getStatistics().getEntityLoadCount() ); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/reventity/MonotonicRevisionNumberTest.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/reventity/MonotonicRevisionNumberTest.java index 545550dfe4..8614444baa 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/reventity/MonotonicRevisionNumberTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/reventity/MonotonicRevisionNumberTest.java @@ -40,7 +40,7 @@ public class MonotonicRevisionNumberTest extends BaseEnversFunctionalTestCase { @Test public void testOracleSequenceOrder() { - EntityPersister persister = sessionFactory().getEntityPersister( SequenceIdRevisionEntity.class.getName() ); + EntityPersister persister = sessionFactory().getMetamodel().entityPersister(SequenceIdRevisionEntity.class.getName()); IdentifierGenerator generator = persister.getIdentifierGenerator(); Assert.assertTrue( OrderedSequenceGenerator.class.isInstance( generator ) );