actually remove deprecated operations of SessionFactoryImplementor and SessionImplementor

This commit is contained in:
Gavin King 2022-01-23 11:09:18 +01:00
parent 4b26cb5876
commit 9724fb0d9b
84 changed files with 242 additions and 508 deletions

View File

@ -1299,9 +1299,7 @@ public interface Session extends SharedSessionContract, EntityManager {
RootGraph<?> getEntityGraph(String graphName);
@Override
default <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass) {
return getSessionFactory().findEntityGraphsByType( entityClass );
}
<T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass);
// The following overrides should not be necessary,
// and are only needed to work around a bug in IntelliJ

View File

@ -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++ ) {

View File

@ -245,7 +245,7 @@ public abstract class AbstractPersistentCollection<E> implements Serializable, P
}
session.getPersistenceContextInternal().addUninitializedDetachedCollection(
session.getFactory().getCollectionPersister( getRole() ),
session.getFactory().getMetamodel().collectionPersister(getRole()),
this
);
}
@ -480,7 +480,7 @@ public abstract class AbstractPersistentCollection<E> 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<E> 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<E> 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<E> 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(

View File

@ -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() );

View File

@ -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() );

View File

@ -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() );

View File

@ -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 <E extends Enum<E>> void setCompressedValue(EnumState<E> 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 extends Enum<E>> E getCompressedValue(EnumState<E> 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;

View File

@ -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;

View File

@ -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 ) {

View File

@ -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(

View File

@ -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 );
}
}

View File

@ -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

View File

@ -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);
}
}

View File

@ -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();

View File

@ -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<String, EntityPersister> 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<String, CollectionPersister> 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<String> 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<EntityNameResolver> 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 <T> List<RootGraphImplementor<? super T>> findEntityGraphsByJavaType(Class<T> 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 <T> List<EntityGraph<? super T>> findEntityGraphsByType(Class<T> entityClass) {
return delegate.findEntityGraphsByType(entityClass);
}
}

View File

@ -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.
* <p>
* 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<EntityNameResolver> 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.
* <p/>
* 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 <T> List<EntityGraph<? super T>> findEntityGraphsByType(Class<T> entityClass) {
return (List) findEntityGraphsByJavaType( entityClass );
}
<T> List<RootGraphImplementor<? super T>> findEntityGraphsByJavaType(Class<T> 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<String,EntityPersister> 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<String, CollectionPersister> 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<String> 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 );
}
}

View File

@ -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:
* <ul>
* <li>
* {@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
* </li>
* <li>
* {@link TransactionCoordinatorBuilder.Options}
* to drive the creation of the {@link TransactionCoordinator} delegate
* </li>
* <li>
* {@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
* </li>
* <li>
* {@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
* </li>
* </ul>
*
* 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);

View File

@ -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) {
}

View File

@ -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" );
}

View File

@ -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;

View File

@ -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 ) ) {

View File

@ -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 );
}

View File

@ -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!

View File

@ -75,7 +75,7 @@ public class FilterConfiguration {
}
if ( aliasEntityMap != null ) {
for ( Map.Entry<String, String> entry : aliasEntityMap.entrySet() ) {
Joinable joinable = (Joinable) factory.getEntityPersister( entry.getValue() );
Joinable joinable = (Joinable) factory.getMetamodel().entityPersister(entry.getValue());
ret.put( entry.getKey(), joinable.getTableName() );
}
}

View File

@ -607,18 +607,11 @@ public class SessionFactoryImpl implements SessionFactoryImplementor {
);
}
@SuppressWarnings("deprecation")
public Settings getSettings() {
return settings;
}
@Override
public <T> List<RootGraphImplementor<? super T>> findEntityGraphsByJavaType(Class<T> entityClass) {
return getMetamodel().findEntityGraphsByJavaType( entityClass );
public <T> List<EntityGraph<? super T>> findEntityGraphsByType(Class<T> 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<? extends Interceptor> or just the
* Class<? extends Interceptor>, 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
}
}

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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();
}
}

View File

@ -134,7 +134,7 @@ public class DiscriminatorType<T> extends AbstractType implements BasicType<T>,
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<T> extends AbstractType implements BasicType<T>,
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<T> extends AbstractType implements BasicType<T>,
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 );
}

View File

@ -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 {
* <p/>
* For the persister for JoinedEntity, we'd have:
* <pre>
* 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"]
* </pre>
* 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

View File

@ -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
*/

View File

@ -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<String, String[]> 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 );

View File

@ -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

View File

@ -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

View File

@ -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<Object> runtimeType = assertTyping( CustomType.class, p.getPropertyType( "nature" ) );
EnumType runtimeEnumType = assertTyping( EnumType.class, runtimeType.getUserType() );
assertEquals( Types.VARCHAR, runtimeEnumType.sqlTypes()[0] );

View File

@ -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;

View File

@ -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;

View File

@ -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 );
}

View File

@ -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();

View File

@ -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() );
}

View File

@ -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",

View File

@ -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;

View File

@ -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() );

View File

@ -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() );

View File

@ -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() );

View File

@ -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() );

View File

@ -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...

View File

@ -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 );
}

View File

@ -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 );
}

View File

@ -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 );
}

View File

@ -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(

View File

@ -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 )

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();
}

View File

@ -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() );

View File

@ -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() );

View File

@ -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(

View File

@ -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() ) );

View File

@ -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" );

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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" ) );

View File

@ -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();

View File

@ -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,

View File

@ -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 );

View File

@ -49,7 +49,7 @@ public class CustomSqlSchemaResolvingIdentityTest {
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];

View File

@ -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];

View File

@ -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();

View File

@ -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 );

View File

@ -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 );

View File

@ -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();

View File

@ -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 ) );