actually remove deprecated operations of SessionFactoryImplementor and SessionImplementor
This commit is contained in:
parent
4b26cb5876
commit
9724fb0d9b
|
@ -1299,9 +1299,7 @@ public interface Session extends SharedSessionContract, EntityManager {
|
||||||
RootGraph<?> getEntityGraph(String graphName);
|
RootGraph<?> getEntityGraph(String graphName);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass) {
|
<T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass);
|
||||||
return getSessionFactory().findEntityGraphsByType( entityClass );
|
|
||||||
}
|
|
||||||
|
|
||||||
// The following overrides should not be necessary,
|
// The following overrides should not be necessary,
|
||||||
// and are only needed to work around a bug in IntelliJ
|
// and are only needed to work around a bug in IntelliJ
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class StructuredCacheEntry implements CacheEntryStructure {
|
||||||
final Map map = (Map) structured;
|
final Map map = (Map) structured;
|
||||||
final String subclass = (String) map.get( SUBCLASS_KEY );
|
final String subclass = (String) map.get( SUBCLASS_KEY );
|
||||||
final Object version = map.get( VERSION_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 String[] names = subclassPersister.getPropertyNames();
|
||||||
final Serializable[] disassembledState = new Serializable[names.length];
|
final Serializable[] disassembledState = new Serializable[names.length];
|
||||||
for ( int i = 0; i < names.length; i++ ) {
|
for ( int i = 0; i < names.length; i++ ) {
|
||||||
|
|
|
@ -245,7 +245,7 @@ public abstract class AbstractPersistentCollection<E> implements Serializable, P
|
||||||
}
|
}
|
||||||
|
|
||||||
session.getPersistenceContextInternal().addUninitializedDetachedCollection(
|
session.getPersistenceContextInternal().addUninitializedDetachedCollection(
|
||||||
session.getFactory().getCollectionPersister( getRole() ),
|
session.getFactory().getMetamodel().collectionPersister(getRole()),
|
||||||
this
|
this
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1214,7 +1214,7 @@ public abstract class AbstractPersistentCollection<E> implements Serializable, P
|
||||||
return oldElements;
|
return oldElements;
|
||||||
}
|
}
|
||||||
|
|
||||||
final EntityPersister entityPersister = session.getFactory().getEntityPersister( entityName );
|
final EntityPersister entityPersister = session.getFactory().getMetamodel().entityPersister(entityName);
|
||||||
final Type idType = entityPersister.getIdentifierType();
|
final Type idType = entityPersister.getIdentifierType();
|
||||||
final boolean useIdDirect = mayUseIdDirect( idType );
|
final boolean useIdDirect = mayUseIdDirect( idType );
|
||||||
|
|
||||||
|
@ -1281,7 +1281,7 @@ public abstract class AbstractPersistentCollection<E> implements Serializable, P
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
|
||||||
if ( entityInstance != null && ForeignKeys.isNotTransient( entityName, entityInstance, null, 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 Type idType = entityPersister.getIdentifierType();
|
||||||
|
|
||||||
final Object idOfCurrent = ForeignKeys.getEntityIdentifierIfNotUnsaved( entityName, entityInstance, session );
|
final Object idOfCurrent = ForeignKeys.getEntityIdentifierIfNotUnsaved( entityName, entityInstance, session );
|
||||||
|
|
|
@ -108,7 +108,6 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry {
|
||||||
/**
|
/**
|
||||||
* This for is used during custom deserialization handling
|
* This for is used during custom deserialization handling
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings( {"JavaDoc"})
|
|
||||||
protected AbstractEntityEntry(
|
protected AbstractEntityEntry(
|
||||||
final SessionFactoryImplementor factory,
|
final SessionFactoryImplementor factory,
|
||||||
final String entityName,
|
final String entityName,
|
||||||
|
@ -122,7 +121,7 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry {
|
||||||
final boolean existsInDatabase,
|
final boolean existsInDatabase,
|
||||||
final boolean isBeingReplicated,
|
final boolean isBeingReplicated,
|
||||||
final PersistenceContext persistenceContext) {
|
final PersistenceContext persistenceContext) {
|
||||||
this.persister = ( factory == null ? null : factory.getEntityPersister( entityName ) );
|
this.persister = ( factory == null ? null : factory.getMetamodel().entityPersister(entityName));
|
||||||
this.id = id;
|
this.id = id;
|
||||||
setCompressedValue( EnumState.STATUS, status );
|
setCompressedValue( EnumState.STATUS, status );
|
||||||
setCompressedValue( EnumState.PREVIOUS_STATUS, previousStatus );
|
setCompressedValue( EnumState.PREVIOUS_STATUS, previousStatus );
|
||||||
|
@ -328,10 +327,7 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry {
|
||||||
final PersistentAttributeInterceptor interceptor = interceptable.$$_hibernate_getInterceptor();
|
final PersistentAttributeInterceptor interceptor = interceptable.$$_hibernate_getInterceptor();
|
||||||
if ( interceptor instanceof EnhancementAsProxyLazinessInterceptor ) {
|
if ( interceptor instanceof EnhancementAsProxyLazinessInterceptor ) {
|
||||||
EnhancementAsProxyLazinessInterceptor enhancementAsProxyLazinessInterceptor = (EnhancementAsProxyLazinessInterceptor) interceptor;
|
EnhancementAsProxyLazinessInterceptor enhancementAsProxyLazinessInterceptor = (EnhancementAsProxyLazinessInterceptor) interceptor;
|
||||||
if ( enhancementAsProxyLazinessInterceptor.hasWrittenFieldNames() ) {
|
return !enhancementAsProxyLazinessInterceptor.hasWrittenFieldNames();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( entity instanceof HibernateProxy ) {
|
else if ( entity instanceof HibernateProxy ) {
|
||||||
|
@ -607,7 +603,7 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry {
|
||||||
private final int mask;
|
private final int mask;
|
||||||
private final int unsetMask;
|
private final int unsetMask;
|
||||||
|
|
||||||
private BooleanState(int offset) {
|
BooleanState(int offset) {
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
this.mask = 0x1 << offset;
|
this.mask = 0x1 << offset;
|
||||||
this.unsetMask = 0xFFFF & ~mask;
|
this.unsetMask = 0xFFFF & ~mask;
|
||||||
|
|
|
@ -460,7 +460,7 @@ public final class Cascade {
|
||||||
final CascadeStyle style,
|
final CascadeStyle style,
|
||||||
final Object anything,
|
final Object anything,
|
||||||
final CollectionType type) {
|
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();
|
final Type elemType = persister.getElementType();
|
||||||
|
|
||||||
CascadePoint elementsCascadePoint = cascadePoint;
|
CascadePoint elementsCascadePoint = cascadePoint;
|
||||||
|
|
|
@ -13,9 +13,6 @@ import java.util.Map;
|
||||||
import org.hibernate.JDBCException;
|
import org.hibernate.JDBCException;
|
||||||
import org.hibernate.engine.jdbc.batch.spi.BatchKey;
|
import org.hibernate.engine.jdbc.batch.spi.BatchKey;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
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
|
* 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
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class NonBatchingBatch extends AbstractBatchImpl {
|
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) {
|
protected NonBatchingBatch(BatchKey key, JdbcCoordinator jdbcCoordinator) {
|
||||||
super( key, jdbcCoordinator );
|
super( key, jdbcCoordinator );
|
||||||
|
|
|
@ -67,7 +67,7 @@ public final class CollectionKey implements Serializable {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CollectionKey"
|
return "CollectionKey"
|
||||||
+ MessageHelper.collectionInfoString( factory.getCollectionPersister( role ), key, factory );
|
+ MessageHelper.collectionInfoString(factory.getMetamodel().collectionPersister(role), key, factory );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -149,7 +149,7 @@ public final class EntityKey implements Serializable {
|
||||||
public static EntityKey deserialize(ObjectInputStream ois, SessionFactoryImplementor sessionFactory) throws IOException, ClassNotFoundException {
|
public static EntityKey deserialize(ObjectInputStream ois, SessionFactoryImplementor sessionFactory) throws IOException, ClassNotFoundException {
|
||||||
final Object id = ois.readObject();
|
final Object id = ois.readObject();
|
||||||
final String entityName = (String) 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);
|
return new EntityKey(id, entityPersister);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1065,11 +1065,6 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
|
||||||
delegate.addEventListeners( listeners );
|
delegate.addEventListeners( listeners );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFlushBeforeCompletionEnabled() {
|
|
||||||
return delegate.isFlushBeforeCompletionEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionQueue getActionQueue() {
|
public ActionQueue getActionQueue() {
|
||||||
return delegate.getActionQueue();
|
return delegate.getActionQueue();
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.hibernate.StatelessSessionBuilder;
|
||||||
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
||||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||||
import org.hibernate.cache.spi.CacheImplementor;
|
import org.hibernate.cache.spi.CacheImplementor;
|
||||||
import org.hibernate.cfg.Settings;
|
|
||||||
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
|
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
|
@ -202,24 +201,24 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
|
||||||
return delegate.getProperties();
|
return delegate.getProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated
|
@Deprecated
|
||||||
public EntityPersister getEntityPersister(String entityName) throws MappingException {
|
public EntityPersister getEntityPersister(String entityName) throws MappingException {
|
||||||
return delegate.getEntityPersister( entityName );
|
return delegate.getMetamodel().entityPersister(entityName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated
|
@Deprecated
|
||||||
public Map<String, EntityPersister> getEntityPersisters() {
|
public Map<String, EntityPersister> getEntityPersisters() {
|
||||||
return delegate.getEntityPersisters();
|
return delegate.getMetamodel().entityPersisters();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated
|
@Deprecated
|
||||||
public CollectionPersister getCollectionPersister(String role) throws MappingException {
|
public CollectionPersister getCollectionPersister(String role) throws MappingException {
|
||||||
return delegate.getCollectionPersister( role );
|
return delegate.getMetamodel().collectionPersister(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated
|
@Deprecated
|
||||||
public Map<String, CollectionPersister> getCollectionPersisters() {
|
public Map<String, CollectionPersister> getCollectionPersisters() {
|
||||||
return delegate.getCollectionPersisters();
|
return delegate.getMetamodel().collectionPersisters();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -232,19 +231,14 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
|
||||||
return delegate.getSqlStringGenerationContext();
|
return delegate.getSqlStringGenerationContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated
|
@Deprecated
|
||||||
public Dialect getDialect() {
|
|
||||||
return delegate.getJdbcServices().getDialect();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override @Deprecated
|
|
||||||
public String[] getImplementors(String className) throws MappingException {
|
public String[] getImplementors(String className) throws MappingException {
|
||||||
return delegate.getImplementors( className );
|
return delegate.getMetamodel().getImplementors(className);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated
|
@Deprecated
|
||||||
public String getImportedClassName(String name) {
|
public String getImportedClassName(String name) {
|
||||||
return delegate.getImportedClassName( name );
|
return delegate.getMetamodel().getImportedClassName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -257,34 +251,14 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
|
||||||
return delegate.bestGuessEntityName( object );
|
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
|
@Override
|
||||||
public Session openTemporarySession() throws HibernateException {
|
public Session openTemporarySession() throws HibernateException {
|
||||||
return delegate.openTemporarySession();
|
return delegate.openTemporarySession();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated
|
@Deprecated
|
||||||
public Set<String> getCollectionRolesByEntityParticipant(String entityName) {
|
public Set<String> getCollectionRolesByEntityParticipant(String entityName) {
|
||||||
return delegate.getCollectionRolesByEntityParticipant( entityName );
|
return delegate.getMetamodel().getCollectionRolesByEntityParticipant(entityName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -327,26 +301,11 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
|
||||||
return delegate.getCurrentTenantIdentifierResolver();
|
return delegate.getCurrentTenantIdentifierResolver();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated
|
|
||||||
public Iterable<EntityNameResolver> iterateEntityNameResolvers() {
|
|
||||||
return delegate.iterateEntityNameResolvers();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FastSessionServices getFastSessionServices() {
|
public FastSessionServices getFastSessionServices() {
|
||||||
return delegate.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
|
@Override
|
||||||
public DeserializationResolver getDeserializationResolver() {
|
public DeserializationResolver getDeserializationResolver() {
|
||||||
return delegate.getDeserializationResolver();
|
return delegate.getDeserializationResolver();
|
||||||
|
@ -392,11 +351,6 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
|
||||||
return delegate.getReference();
|
return delegate.getReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> List<RootGraphImplementor<? super T>> findEntityGraphsByJavaType(Class<T> entityClass) {
|
|
||||||
return delegate.findEntityGraphsByJavaType( entityClass );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityManager createEntityManager() {
|
public EntityManager createEntityManager() {
|
||||||
return delegate.createEntityManager();
|
return delegate.createEntityManager();
|
||||||
|
@ -446,4 +400,9 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
|
||||||
public WrapperOptions getWrapperOptions() {
|
public WrapperOptions getWrapperOptions() {
|
||||||
return delegate.getWrapperOptions();
|
return delegate.getWrapperOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> List<EntityGraph<? super T>> findEntityGraphsByType(Class<T> entityClass) {
|
||||||
|
return delegate.findEntityGraphsByType(entityClass);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,37 +7,24 @@
|
||||||
package org.hibernate.engine.spi;
|
package org.hibernate.engine.spi;
|
||||||
|
|
||||||
import java.io.Serializable;
|
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.CustomEntityDirtinessStrategy;
|
||||||
import org.hibernate.EntityNameResolver;
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.MappingException;
|
|
||||||
import org.hibernate.Metamodel;
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.SessionFactoryObserver;
|
import org.hibernate.SessionFactoryObserver;
|
||||||
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
||||||
import org.hibernate.cache.spi.CacheImplementor;
|
import org.hibernate.cache.spi.CacheImplementor;
|
||||||
import org.hibernate.cfg.Settings;
|
|
||||||
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
|
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
|
||||||
import org.hibernate.dialect.Dialect;
|
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
|
||||||
import org.hibernate.engine.profile.FetchProfile;
|
import org.hibernate.engine.profile.FetchProfile;
|
||||||
import org.hibernate.event.spi.EventEngine;
|
import org.hibernate.event.spi.EventEngine;
|
||||||
import org.hibernate.exception.spi.SQLExceptionConverter;
|
|
||||||
import org.hibernate.graph.spi.RootGraphImplementor;
|
import org.hibernate.graph.spi.RootGraphImplementor;
|
||||||
import org.hibernate.id.IdentifierGenerator;
|
import org.hibernate.id.IdentifierGenerator;
|
||||||
import org.hibernate.metamodel.MappingMetamodel;
|
import org.hibernate.metamodel.MappingMetamodel;
|
||||||
import org.hibernate.metamodel.RuntimeMetamodels;
|
import org.hibernate.metamodel.RuntimeMetamodels;
|
||||||
import org.hibernate.internal.FastSessionServices;
|
import org.hibernate.internal.FastSessionServices;
|
||||||
import org.hibernate.metamodel.spi.MetamodelImplementor;
|
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.proxy.EntityNotFoundDelegate;
|
||||||
import org.hibernate.query.criteria.HibernateCriteriaBuilder;
|
import org.hibernate.query.criteria.HibernateCriteriaBuilder;
|
||||||
import org.hibernate.query.spi.QueryEngine;
|
import org.hibernate.query.spi.QueryEngine;
|
||||||
|
@ -50,8 +37,8 @@ import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.spi.TypeConfiguration;
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the internal contract between the {@code SessionFactory} and other parts of
|
* Defines the internal contract between the {@link SessionFactory} and the internal
|
||||||
* Hibernate such as implementors of {@code Type}.
|
* implementation of Hibernate.
|
||||||
*
|
*
|
||||||
* @see SessionFactory
|
* @see SessionFactory
|
||||||
* @see org.hibernate.internal.SessionFactoryImpl
|
* @see org.hibernate.internal.SessionFactoryImpl
|
||||||
|
@ -62,8 +49,9 @@ import org.hibernate.type.spi.TypeConfiguration;
|
||||||
public interface SessionFactoryImplementor
|
public interface SessionFactoryImplementor
|
||||||
extends Mapping, SessionFactory, SqmCreationContext, SqlAstCreationContext, QueryParameterBindingTypeResolver {
|
extends Mapping, SessionFactory, SqmCreationContext, SqlAstCreationContext, QueryParameterBindingTypeResolver {
|
||||||
/**
|
/**
|
||||||
* Get the UUID for this SessionFactory. The value is generated as a {@link java.util.UUID}, but kept
|
* Get the UUID for this SessionFactory.
|
||||||
* as a String.
|
* <p>
|
||||||
|
* The value is generated as a {@link java.util.UUID}, but kept as a String.
|
||||||
*
|
*
|
||||||
* @return The UUID for this SessionFactory.
|
* @return The UUID for this SessionFactory.
|
||||||
*
|
*
|
||||||
|
@ -150,14 +138,6 @@ public interface SessionFactoryImplementor
|
||||||
*/
|
*/
|
||||||
CurrentTenantIdentifierResolver getCurrentTenantIdentifierResolver();
|
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
|
* @return the FastSessionServices instance associated with this SessionFactory
|
||||||
*/
|
*/
|
||||||
|
@ -179,14 +159,6 @@ public interface SessionFactoryImplementor
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// Deprecations
|
// 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.
|
* Get the JdbcServices.
|
||||||
*
|
*
|
||||||
|
@ -194,69 +166,16 @@ public interface SessionFactoryImplementor
|
||||||
*/
|
*/
|
||||||
JdbcServices getJdbcServices();
|
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();
|
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
|
// map these to Metamodel
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
MetamodelImplementor getMetamodel();
|
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);
|
RootGraphImplementor<?> findEntityGraphByName(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -264,84 +183,4 @@ public interface SessionFactoryImplementor
|
||||||
*/
|
*/
|
||||||
String bestGuessEntityName(Object object);
|
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 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,31 +17,33 @@ import org.hibernate.resource.transaction.spi.TransactionCoordinator;
|
||||||
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
|
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the "internal contract" for {@link Session} and other parts of Hibernate such as
|
* Defines the "internal contract" for {@link Session} and other parts of Hibernate such
|
||||||
* {@link org.hibernate.type.Type}, {@link EntityPersister}
|
* as {@link org.hibernate.type.Type}, {@link EntityPersister}
|
||||||
* and {@link org.hibernate.persister.collection.CollectionPersister} implementations.
|
* and {@link org.hibernate.persister.collection.CollectionPersister} implementations.
|
||||||
*
|
*
|
||||||
* A Session, through this interface and SharedSessionContractImplementor, implements:
|
* A Session, through this interface and SharedSessionContractImplementor, implements:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>
|
* <li>
|
||||||
* {@link org.hibernate.resource.jdbc.spi.JdbcSessionOwner} to drive the behavior of the
|
* {@link org.hibernate.resource.jdbc.spi.JdbcSessionOwner} to drive the behavior
|
||||||
* {@link org.hibernate.resource.jdbc.spi.JdbcSessionContext} delegate
|
* of the {@link org.hibernate.resource.jdbc.spi.JdbcSessionContext} delegate
|
||||||
* </li>
|
* </li>
|
||||||
* <li>
|
* <li>
|
||||||
* {@link TransactionCoordinatorBuilder.Options}
|
* {@link TransactionCoordinatorBuilder.Options}
|
||||||
* to drive the creation of the {@link TransactionCoordinator} delegate
|
* to drive the creation of the {@link TransactionCoordinator} delegate
|
||||||
* </li>
|
* </li>
|
||||||
* <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>
|
||||||
* <li>
|
* <li>
|
||||||
* {@link org.hibernate.type.descriptor.WrapperOptions} to fulfill the behavior needed while
|
* {@link org.hibernate.type.descriptor.WrapperOptions} to fulfill the behavior
|
||||||
* binding/extracting values to/from JDBC as part of the Type contracts
|
* needed while binding/extracting values to/from JDBC as part of the {@code Type}
|
||||||
|
* contracts
|
||||||
* </li>
|
* </li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* See also {@link org.hibernate.event.spi.EventSource} which extends this interface providing
|
* See also {@link org.hibernate.event.spi.EventSource} which extends this interface
|
||||||
* bridge to the event generation features of {@link org.hibernate.event}
|
* providing s bridge to the event generation features of {@link org.hibernate.event}.
|
||||||
*
|
*
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -65,13 +67,6 @@ public interface SessionImplementor extends Session, SharedSessionContractImplem
|
||||||
@Override
|
@Override
|
||||||
RootGraphImplementor<?> getEntityGraph(String graphName);
|
RootGraphImplementor<?> getEntityGraph(String graphName);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated (since 5.2) use {@link #getHibernateFlushMode()} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
boolean isFlushBeforeCompletionEnabled();
|
|
||||||
|
|
||||||
ActionQueue getActionQueue();
|
ActionQueue getActionQueue();
|
||||||
|
|
||||||
Object instantiate(EntityPersister persister, Object id) throws HibernateException;
|
Object instantiate(EntityPersister persister, Object id) throws HibernateException;
|
||||||
|
@ -79,37 +74,37 @@ public interface SessionImplementor extends Session, SharedSessionContractImplem
|
||||||
void forceFlush(EntityEntry e) throws HibernateException;
|
void forceFlush(EntityEntry e) throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated OperationalContext should cover this overload I believe; Gail?
|
* @deprecated OperationalContext should cover this overload I believe
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void merge(String entityName, Object object, Map copiedAlready) throws HibernateException;
|
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
|
@Deprecated
|
||||||
void persist(String entityName, Object object, Map createdAlready) throws HibernateException;
|
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
|
@Deprecated
|
||||||
void persistOnFlush(String entityName, Object object, Map copiedAlready);
|
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
|
@Deprecated
|
||||||
void refresh(String entityName, Object object, Map refreshedAlready) throws HibernateException;
|
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
|
@Deprecated
|
||||||
void delete(String entityName, Object child, boolean isCascadeDeleteEnabled, Set transientEntities);
|
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
|
@Deprecated
|
||||||
void removeOrphanBeforeUpdates(String entityName, Object child);
|
void removeOrphanBeforeUpdates(String entityName, Object child);
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class DefaultEvictEventListener implements EvictEventListener {
|
||||||
throw new IllegalArgumentException( "Could not determine identifier of proxy passed to evict()" );
|
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 );
|
final EntityKey key = source.generateEntityKey( id, persister );
|
||||||
persistenceContext.removeProxy( key );
|
persistenceContext.removeProxy( key );
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ public class DefaultEvictEventListener implements EvictEventListener {
|
||||||
final String entityName = persistenceContext.getSession().guessEntityName( object );
|
final String entityName = persistenceContext.getSession().guessEntityName( object );
|
||||||
if ( entityName != null ) {
|
if ( entityName != null ) {
|
||||||
try {
|
try {
|
||||||
persister = persistenceContext.getSession().getFactory().getEntityPersister( entityName );
|
persister = persistenceContext.getSession().getFactory().getMetamodel().entityPersister(entityName);
|
||||||
}
|
}
|
||||||
catch (Exception ignore) {
|
catch (Exception ignore) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class DefaultPersistEventListener
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void onPersist(PersistEvent event) throws HibernateException {
|
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.
|
// entity state again.
|
||||||
|
|
||||||
// NOTE: entityEntry must be null to get here, so we cannot use any of its values
|
// NOTE: entityEntry must be null to get here, so we cannot use any of its values
|
||||||
EntityPersister persister = source.getFactory().getEntityPersister( entityName );
|
EntityPersister persister = source.getFactory().getMetamodel().entityPersister(entityName);
|
||||||
if ( ForeignGenerator.class.isInstance( persister.getIdentifierGenerator() ) ) {
|
if ( persister.getIdentifierGenerator() instanceof ForeignGenerator ) {
|
||||||
if ( LOG.isDebugEnabled() && persister.getIdentifier( entity, source ) != null ) {
|
if ( LOG.isDebugEnabled() && persister.getIdentifier( entity, source ) != null ) {
|
||||||
LOG.debug( "Resetting entity id attribute to null for foreign generator" );
|
LOG.debug( "Resetting entity id attribute to null for foreign generator" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class OnLockVisitor extends ReattachVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
final SessionImplementor session = getSession();
|
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 ) {
|
if ( collection instanceof PersistentCollection ) {
|
||||||
final PersistentCollection<?> persistentCollection = (PersistentCollection<?>) collection;
|
final PersistentCollection<?> persistentCollection = (PersistentCollection<?>) collection;
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class OnUpdateVisitor extends ReattachVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
EventSource session = getSession();
|
EventSource session = getSession();
|
||||||
CollectionPersister persister = session.getFactory().getCollectionPersister( type.getRole() );
|
CollectionPersister persister = session.getFactory().getMetamodel().collectionPersister(type.getRole());
|
||||||
|
|
||||||
final Object collectionKey = extractCollectionKeyFromOwner( persister );
|
final Object collectionKey = extractCollectionKeyFromOwner( persister );
|
||||||
if ( ( collection instanceof PersistentCollection ) ) {
|
if ( ( collection instanceof PersistentCollection ) ) {
|
||||||
|
|
|
@ -61,8 +61,7 @@ public abstract class ProxyVisitor extends AbstractVisitor {
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
final EventSource session = getSession();
|
final EventSource session = getSession();
|
||||||
if ( collection.wasInitialized() ) {
|
if ( collection.wasInitialized() ) {
|
||||||
CollectionPersister collectionPersister = session.getFactory()
|
CollectionPersister collectionPersister = session.getFactory().getMetamodel().collectionPersister(type.getRole());
|
||||||
.getCollectionPersister( type.getRole() );
|
|
||||||
session.getPersistenceContext()
|
session.getPersistenceContext()
|
||||||
.addInitializedDetachedCollection( collectionPersister, collection );
|
.addInitializedDetachedCollection( collectionPersister, collection );
|
||||||
}
|
}
|
||||||
|
@ -70,8 +69,7 @@ public abstract class ProxyVisitor extends AbstractVisitor {
|
||||||
if ( !isCollectionSnapshotValid( collection ) ) {
|
if ( !isCollectionSnapshotValid( collection ) ) {
|
||||||
throw new HibernateException( "could not re-associate uninitialized transient collection" );
|
throw new HibernateException( "could not re-associate uninitialized transient collection" );
|
||||||
}
|
}
|
||||||
CollectionPersister collectionPersister = session.getFactory()
|
CollectionPersister collectionPersister = session.getFactory().getMetamodel().collectionPersister(collection.getRole());
|
||||||
.getCollectionPersister( collection.getRole() );
|
|
||||||
session.getPersistenceContext()
|
session.getPersistenceContext()
|
||||||
.addUninitializedDetachedCollection( collectionPersister, collection );
|
.addUninitializedDetachedCollection( collectionPersister, collection );
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class WrapVisitor extends ProxyVisitor {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CollectionPersister persister = session.getFactory().getCollectionPersister( collectionType.getRole() );
|
CollectionPersister persister = session.getFactory().getMetamodel().collectionPersister(collectionType.getRole());
|
||||||
|
|
||||||
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
|
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
|
||||||
//TODO: move into collection type, so we can use polymorphism!
|
//TODO: move into collection type, so we can use polymorphism!
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class FilterConfiguration {
|
||||||
}
|
}
|
||||||
if ( aliasEntityMap != null ) {
|
if ( aliasEntityMap != null ) {
|
||||||
for ( Map.Entry<String, String> entry : aliasEntityMap.entrySet() ) {
|
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() );
|
ret.put( entry.getKey(), joinable.getTableName() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -607,18 +607,11 @@ public class SessionFactoryImpl implements SessionFactoryImplementor {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public Settings getSettings() {
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> List<RootGraphImplementor<? super T>> findEntityGraphsByJavaType(Class<T> entityClass) {
|
public <T> List<EntityGraph<? super T>> findEntityGraphsByType(Class<T> entityClass) {
|
||||||
return getMetamodel().findEntityGraphsByJavaType( entityClass );
|
return (List) getMetamodel().findEntityGraphsByJavaType( entityClass );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// todo : (5.2) review synchronizationType, persistenceContextType, transactionType usage
|
// todo : (5.2) review synchronizationType, persistenceContextType, transactionType usage
|
||||||
|
|
||||||
// SynchronizationType -> should we auto enlist in transactions
|
// SynchronizationType -> should we auto enlist in transactions
|
||||||
|
@ -708,7 +701,7 @@ public class SessionFactoryImpl implements SessionFactoryImplementor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RootGraphImplementor findEntityGraphByName(String name) {
|
public RootGraphImplementor<?> findEntityGraphByName(String name) {
|
||||||
return getMetamodel().findEntityGraphByName( name );
|
return getMetamodel().findEntityGraphByName( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1027,21 +1020,19 @@ public class SessionFactoryImpl implements SessionFactoryImplementor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( "jta".equals( impl ) ) {
|
switch (impl) {
|
||||||
|
case "jta":
|
||||||
// if ( ! transactionFactory().compatibleWithJtaSynchronization() ) {
|
// if ( ! transactionFactory().compatibleWithJtaSynchronization() ) {
|
||||||
// LOG.autoFlushWillNotWork();
|
// LOG.autoFlushWillNotWork();
|
||||||
// }
|
// }
|
||||||
return new JTASessionContext(this);
|
return new JTASessionContext(this);
|
||||||
}
|
case "thread":
|
||||||
else if ( "thread".equals( impl ) ) {
|
|
||||||
return new ThreadLocalSessionContext(this);
|
return new ThreadLocalSessionContext(this);
|
||||||
}
|
case "managed":
|
||||||
else if ( "managed".equals( impl ) ) {
|
|
||||||
return new ManagedSessionContext(this);
|
return new ManagedSessionContext(this);
|
||||||
}
|
default:
|
||||||
else {
|
|
||||||
try {
|
try {
|
||||||
Class implClass = serviceRegistry.getService( ClassLoaderService.class ).classForName( impl );
|
Class<?> implClass = serviceRegistry.getService(ClassLoaderService.class).classForName(impl);
|
||||||
return (CurrentSessionContext)
|
return (CurrentSessionContext)
|
||||||
implClass.getConstructor( new Class[]{SessionFactoryImplementor.class} )
|
implClass.getConstructor( new Class[]{SessionFactoryImplementor.class} )
|
||||||
.newInstance(this);
|
.newInstance(this);
|
||||||
|
@ -1149,7 +1140,7 @@ public class SessionFactoryImpl implements SessionFactoryImplementor {
|
||||||
}
|
}
|
||||||
else if ( statelessInterceptorImplementor != null ) {
|
else if ( statelessInterceptorImplementor != null ) {
|
||||||
try {
|
try {
|
||||||
/**
|
/*
|
||||||
* We could remove the getStatelessInterceptorImplementor method and use just the getStatelessInterceptorImplementorSupplier
|
* 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
|
* 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.
|
* 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
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public T owner(SessionOwner sessionOwner) {
|
public T owner(SessionOwner sessionOwner) {
|
||||||
throw new UnsupportedOperationException( "SessionOwner was long deprecated and this method should no longer be invoked" );
|
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;
|
return (T) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings("unchecked")
|
||||||
public T jdbcTimeZone(TimeZone timeZone) {
|
public T jdbcTimeZone(TimeZone timeZone) {
|
||||||
jdbcTimeZone = timeZone;
|
jdbcTimeZone = timeZone;
|
||||||
return (T) this;
|
return (T) this;
|
||||||
|
@ -1684,6 +1674,6 @@ public class SessionFactoryImpl implements SessionFactoryImplementor {
|
||||||
private enum Status {
|
private enum Status {
|
||||||
OPEN,
|
OPEN,
|
||||||
CLOSING,
|
CLOSING,
|
||||||
CLOSED;
|
CLOSED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2190,11 +2190,6 @@ public class SessionImpl
|
||||||
return status == TransactionStatus.ACTIVE || status == TransactionStatus.COMMITTING;
|
return status == TransactionStatus.ACTIVE || status == TransactionStatus.COMMITTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFlushBeforeCompletionEnabled() {
|
|
||||||
return getHibernateFlushMode() != FlushMode.MANUAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SessionImplementor getSession() {
|
public SessionImplementor getSession() {
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -39,7 +39,7 @@ public final class EntityPrinter {
|
||||||
* @return the entity rendered to a string
|
* @return the entity rendered to a string
|
||||||
*/
|
*/
|
||||||
public String toString(String entityName, Object entity) throws HibernateException {
|
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 ) ) {
|
if ( entityPersister == null || !entityPersister.isInstance( entity ) ) {
|
||||||
return entity.getClass().getName();
|
return entity.getClass().getName();
|
||||||
|
|
|
@ -141,8 +141,7 @@ public class CacheEntityLoaderHelper {
|
||||||
}
|
}
|
||||||
if ( options.isAllowNulls() ) {
|
if ( options.isAllowNulls() ) {
|
||||||
final EntityPersister persister = event.getSession()
|
final EntityPersister persister = event.getSession()
|
||||||
.getFactory()
|
.getFactory().getMetamodel().entityPersister(keyToLoad.getEntityName());
|
||||||
.getEntityPersister( keyToLoad.getEntityName() );
|
|
||||||
if ( !persister.isInstance( old ) ) {
|
if ( !persister.isInstance( old ) ) {
|
||||||
LOG.debug(
|
LOG.debug(
|
||||||
"Load request found matching entity in context, but the matched entity was of an inconsistent return type; returning null"
|
"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;
|
final Object entity;
|
||||||
|
|
||||||
subclassPersister = factory.getEntityPersister( entry.getSubclass() );
|
subclassPersister = factory.getMetamodel().entityPersister(entry.getSubclass());
|
||||||
entity = instanceToLoad == null
|
entity = instanceToLoad == null
|
||||||
? source.instantiate( subclassPersister, entityId )
|
? source.instantiate( subclassPersister, entityId )
|
||||||
: instanceToLoad;
|
: instanceToLoad;
|
||||||
|
|
|
@ -134,7 +134,7 @@ public class DiscriminatorType<T> extends AbstractType implements BasicType<T>,
|
||||||
int index,
|
int index,
|
||||||
SharedSessionContractImplementor session) throws HibernateException, SQLException {
|
SharedSessionContractImplementor session) throws HibernateException, SQLException {
|
||||||
String entityName = session.getFactory().getClassMetadata((Class) value).getEntityName();
|
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);
|
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 {
|
public void bind(PreparedStatement st, T value, int index, WrapperOptions options) throws SQLException {
|
||||||
final SessionFactoryImplementor factory = options.getSession().getFactory();
|
final SessionFactoryImplementor factory = options.getSession().getFactory();
|
||||||
final String entityName = factory.getClassMetadata( (Class) value).getEntityName();
|
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 );
|
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 {
|
public void bind(CallableStatement st, T value, String name, WrapperOptions options) throws SQLException {
|
||||||
final SessionFactoryImplementor factory = options.getSession().getFactory();
|
final SessionFactoryImplementor factory = options.getSession().getFactory();
|
||||||
final String entityName = factory.getClassMetadata( (Class) value).getEntityName();
|
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 );
|
underlyingType.getJdbcValueBinder().bind( st, entityPersister.getDiscriminatorValue(), name, options );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer {
|
||||||
session = s;
|
session = s;
|
||||||
if ( readOnlyBeforeAttachedToSession == null ) {
|
if ( readOnlyBeforeAttachedToSession == null ) {
|
||||||
// use the default read-only/modifiable setting
|
// 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() );
|
setReadOnly( s.getPersistenceContext().isDefaultReadOnly() || !persister.isMutable() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -151,7 +151,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer {
|
||||||
if ( id == null || s == null || entityName == null ) {
|
if ( id == null || s == null || entityName == null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return s.generateEntityKey( id, s.getFactory().getEntityPersister( entityName ) );
|
return s.generateEntityKey( id, s.getFactory().getMetamodel().entityPersister(entityName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -371,7 +371,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer {
|
||||||
errorIfReadOnlySettingNotAvailable();
|
errorIfReadOnlySettingNotAvailable();
|
||||||
// only update if readOnly is different from current setting
|
// only update if readOnly is different from current setting
|
||||||
if ( this.readOnly != readOnly ) {
|
if ( this.readOnly != readOnly ) {
|
||||||
final EntityPersister persister = session.getFactory().getEntityPersister( entityName );
|
final EntityPersister persister = session.getFactory().getMetamodel().entityPersister(entityName);
|
||||||
if ( !persister.isMutable() && !readOnly ) {
|
if ( !persister.isMutable() && !readOnly ) {
|
||||||
throw new IllegalStateException( "cannot make proxies [" + entityName + "#" + id + "] for immutable entities modifiable" );
|
throw new IllegalStateException( "cannot make proxies [" + entityName + "#" + id + "] for immutable entities modifiable" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,7 +384,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
private SQLLoadable getSQLLoadable(String entityName) throws MappingException {
|
private SQLLoadable getSQLLoadable(String entityName) throws MappingException {
|
||||||
EntityPersister persister = factory.getEntityPersister( entityName );
|
EntityPersister persister = factory.getMetamodel().entityPersister(entityName);
|
||||||
if ( !(persister instanceof SQLLoadable) ) {
|
if ( !(persister instanceof SQLLoadable) ) {
|
||||||
throw new MappingException( "class persister is not SQLLoadable: " + entityName );
|
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) {
|
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 );
|
alias2CollectionPersister.put( alias, collectionPersister );
|
||||||
String suffix = generateCollectionSuffix();
|
String suffix = generateCollectionSuffix();
|
||||||
LOG.tracev( "Mapping alias [{0}] to collection-suffix [{1}]", alias, suffix );
|
LOG.tracev( "Mapping alias [{0}] to collection-suffix [{1}]", alias, suffix );
|
||||||
|
|
|
@ -469,7 +469,7 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
@Override
|
@Override
|
||||||
public Joinable getAssociatedJoinable(SessionFactoryImplementor factory)
|
public Joinable getAssociatedJoinable(SessionFactoryImplementor factory)
|
||||||
throws MappingException {
|
throws MappingException {
|
||||||
return (Joinable) factory.getCollectionPersister( role );
|
return (Joinable) factory.getMetamodel().collectionPersister(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -482,8 +482,7 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
throws MappingException {
|
throws MappingException {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
QueryableCollection collectionPersister = (QueryableCollection) factory
|
QueryableCollection collectionPersister = (QueryableCollection) factory.getMetamodel().collectionPersister(role);
|
||||||
.getCollectionPersister( role );
|
|
||||||
|
|
||||||
if ( !collectionPersister.getElementType().isEntityType() ) {
|
if ( !collectionPersister.getElementType().isEntityType() ) {
|
||||||
throw new MappingException(
|
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.
|
* @throws MappingException Indicates the underlying persister could not be located.
|
||||||
*/
|
*/
|
||||||
public final Type getElementType(SessionFactoryImplementor factory) throws MappingException {
|
public final Type getElementType(SessionFactoryImplementor factory) throws MappingException {
|
||||||
return factory.getCollectionPersister( getRole() ).getElementType();
|
return factory.getMetamodel().collectionPersister(getRole()).getElementType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -52,14 +52,14 @@ public class EntityNonEntityTest extends BaseCoreFunctionalTestCase {
|
||||||
@TestForIssue( jiraKey = "HHH-9856" )
|
@TestForIssue( jiraKey = "HHH-9856" )
|
||||||
public void testGetAndFindNonEntityThrowsIllegalArgumentException() {
|
public void testGetAndFindNonEntityThrowsIllegalArgumentException() {
|
||||||
try {
|
try {
|
||||||
sessionFactory().locateEntityPersister( Cellular.class );
|
sessionFactory().getMetamodel().locateEntityPersister(Cellular.class);
|
||||||
}
|
}
|
||||||
catch (UnknownEntityTypeException ignore) {
|
catch (UnknownEntityTypeException ignore) {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sessionFactory().locateEntityPersister( Cellular.class.getName() );
|
sessionFactory().getMetamodel().locateEntityPersister(Cellular.class.getName());
|
||||||
}
|
}
|
||||||
catch (UnknownEntityTypeException ignore) {
|
catch (UnknownEntityTypeException ignore) {
|
||||||
// expected
|
// expected
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class EnumeratedWithMappedSuperclassTest extends BaseUnitTestCase {
|
||||||
|
|
||||||
SessionFactoryImplementor sf = (SessionFactoryImplementor) metadata.buildSessionFactory();
|
SessionFactoryImplementor sf = (SessionFactoryImplementor) metadata.buildSessionFactory();
|
||||||
try {
|
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" ) );
|
CustomType<Object> runtimeType = assertTyping( CustomType.class, p.getPropertyType( "nature" ) );
|
||||||
EnumType runtimeEnumType = assertTyping( EnumType.class, runtimeType.getUserType() );
|
EnumType runtimeEnumType = assertTyping( EnumType.class, runtimeType.getUserType() );
|
||||||
assertEquals( Types.VARCHAR, runtimeEnumType.sqlTypes()[0] );
|
assertEquals( Types.VARCHAR, runtimeEnumType.sqlTypes()[0] );
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class NewGeneratorMappingsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMinimalSequenceEntity(SessionFactoryScope scope) {
|
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();
|
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
||||||
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
||||||
SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator;
|
SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator;
|
||||||
|
@ -71,7 +71,7 @@ public class NewGeneratorMappingsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCompleteSequenceEntity(SessionFactoryScope scope) {
|
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();
|
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
||||||
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
||||||
SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator;
|
SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator;
|
||||||
|
@ -82,7 +82,7 @@ public class NewGeneratorMappingsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAutoEntity(SessionFactoryScope scope) {
|
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();
|
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
||||||
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
||||||
SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator;
|
SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator;
|
||||||
|
@ -93,7 +93,7 @@ public class NewGeneratorMappingsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTablePerClassAutoEntity(SessionFactoryScope scope) {
|
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();
|
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
||||||
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
||||||
SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator;
|
SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator;
|
||||||
|
@ -105,7 +105,7 @@ public class NewGeneratorMappingsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMinimalTableEntity(SessionFactoryScope scope) {
|
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();
|
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
||||||
assertTrue( TableGenerator.class.isInstance( generator ) );
|
assertTrue( TableGenerator.class.isInstance( generator ) );
|
||||||
TableGenerator tabGenerator = (TableGenerator) generator;
|
TableGenerator tabGenerator = (TableGenerator) generator;
|
||||||
|
@ -124,7 +124,7 @@ public class NewGeneratorMappingsTest {
|
||||||
@TestForIssue(jiraKey = "HHH-6790")
|
@TestForIssue(jiraKey = "HHH-6790")
|
||||||
public void testSequencePerEntity(SessionFactoryScope scope) {
|
public void testSequencePerEntity(SessionFactoryScope scope) {
|
||||||
// Checking first entity.
|
// Checking first entity.
|
||||||
EntityPersister persister = scope.getSessionFactory().getEntityPersister( DedicatedSequenceEntity1.class.getName() );
|
EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(DedicatedSequenceEntity1.class.getName());
|
||||||
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
||||||
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
||||||
SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator;
|
SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator;
|
||||||
|
@ -134,7 +134,7 @@ public class NewGeneratorMappingsTest {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Checking second entity.
|
// Checking second entity.
|
||||||
persister = scope.getSessionFactory().getEntityPersister( DedicatedSequenceEntity2.class.getName() );
|
persister = scope.getSessionFactory().getMetamodel().entityPersister(DedicatedSequenceEntity2.class.getName());
|
||||||
generator = persister.getIdentifierGenerator();
|
generator = persister.getIdentifierGenerator();
|
||||||
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
||||||
seqGenerator = (SequenceStyleGenerator) generator;
|
seqGenerator = (SequenceStyleGenerator) generator;
|
||||||
|
|
|
@ -41,8 +41,7 @@ public class HibernateSequenceTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHibernateSequenceSchema(SessionFactoryScope scope) {
|
public void testHibernateSequenceSchema(SessionFactoryScope scope) {
|
||||||
EntityPersister persister = scope.getSessionFactory()
|
EntityPersister persister = scope.getSessionFactory().getMetamodel().entityPersister(HibernateSequenceEntity.class.getName());
|
||||||
.getEntityPersister( HibernateSequenceEntity.class.getName() );
|
|
||||||
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
||||||
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
assertTrue( SequenceStyleGenerator.class.isInstance( generator ) );
|
||||||
SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator;
|
SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator;
|
||||||
|
|
|
@ -33,8 +33,8 @@ public class MaterializedBlobTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTypeSelection() {
|
public void testTypeSelection() {
|
||||||
int index = sessionFactory().getEntityPersister( MaterializedBlobEntity.class.getName() ).getEntityMetamodel().getPropertyIndex( "theBytes" );
|
int index = sessionFactory().getMetamodel().entityPersister(MaterializedBlobEntity.class.getName()).getEntityMetamodel().getPropertyIndex( "theBytes" );
|
||||||
BasicType<?> type = (BasicType<?>) sessionFactory().getEntityPersister( MaterializedBlobEntity.class.getName() ).getEntityMetamodel().getProperties()[index].getType();
|
BasicType<?> type = (BasicType<?>) sessionFactory().getMetamodel().entityPersister(MaterializedBlobEntity.class.getName()).getEntityMetamodel().getProperties()[index].getType();
|
||||||
assertTrue( type.getJavaTypeDescriptor() instanceof PrimitiveByteArrayJavaType );
|
assertTrue( type.getJavaTypeDescriptor() instanceof PrimitiveByteArrayJavaType );
|
||||||
assertTrue( type.getJdbcType() instanceof BlobJdbcType );
|
assertTrue( type.getJdbcType() instanceof BlobJdbcType );
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,8 +275,7 @@ public class OrderByTest extends BaseCoreFunctionalTestCase {
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue(jiraKey = "HHH-5732")
|
@TestForIssue(jiraKey = "HHH-5732")
|
||||||
public void testInverseIndex() {
|
public void testInverseIndex() {
|
||||||
final CollectionPersister transactionsPersister = sessionFactory().getCollectionPersister(
|
final CollectionPersister transactionsPersister = sessionFactory().getMetamodel().collectionPersister(BankAccount.class.getName() + ".transactions");
|
||||||
BankAccount.class.getName() + ".transactions" );
|
|
||||||
assertTrue( transactionsPersister.isInverse() );
|
assertTrue( transactionsPersister.isInverse() );
|
||||||
|
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class QualifiedTableNamingTest extends BaseNonConfigCoreFunctionalTestCas
|
||||||
|
|
||||||
assertNotNull( expectedName );
|
assertNotNull( expectedName );
|
||||||
|
|
||||||
SingleTableEntityPersister persister = (SingleTableEntityPersister) sessionFactory().getEntityPersister( Box.class.getName() );
|
SingleTableEntityPersister persister = (SingleTableEntityPersister) sessionFactory().getMetamodel().entityPersister(Box.class.getName());
|
||||||
assertEquals( expectedName, persister.getTableName() );
|
assertEquals( expectedName, persister.getTableName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,20 +12,6 @@ import org.hibernate.cfg.Configuration;
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.internal.BasicEntityIdentifierMappingImpl;
|
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.persister.entity.EntityPersister;
|
||||||
import org.hibernate.property.access.spi.GetterFieldImpl;
|
import org.hibernate.property.access.spi.GetterFieldImpl;
|
||||||
import org.hibernate.property.access.spi.GetterMethodImpl;
|
import org.hibernate.property.access.spi.GetterMethodImpl;
|
||||||
|
@ -90,7 +76,7 @@ public class AccessMappingTest {
|
||||||
cfg.addAnnotatedClass( Student.class );
|
cfg.addAnnotatedClass( Student.class );
|
||||||
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
||||||
try {
|
try {
|
||||||
final EntityPersister entityPersister = factory.getEntityPersister( classUnderTest.getName() );
|
final EntityPersister entityPersister = factory.getMetamodel().entityPersister(classUnderTest.getName());
|
||||||
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
||||||
|
|
||||||
assertTrue(
|
assertTrue(
|
||||||
|
@ -111,7 +97,7 @@ public class AccessMappingTest {
|
||||||
cfg.addAnnotatedClass( Student.class );
|
cfg.addAnnotatedClass( Student.class );
|
||||||
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
||||||
try {
|
try {
|
||||||
final EntityPersister entityPersister = factory.getEntityPersister( classUnderTest.getName() );
|
final EntityPersister entityPersister = factory.getMetamodel().entityPersister(classUnderTest.getName());
|
||||||
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
||||||
|
|
||||||
assertTrue(
|
assertTrue(
|
||||||
|
@ -132,7 +118,7 @@ public class AccessMappingTest {
|
||||||
cfg.addAnnotatedClass( Student.class );
|
cfg.addAnnotatedClass( Student.class );
|
||||||
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
||||||
try {
|
try {
|
||||||
final EntityPersister entityPersister = factory.getEntityPersister( classUnderTest.getName() );
|
final EntityPersister entityPersister = factory.getMetamodel().entityPersister(classUnderTest.getName());
|
||||||
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
||||||
|
|
||||||
assertTrue(
|
assertTrue(
|
||||||
|
@ -173,7 +159,7 @@ public class AccessMappingTest {
|
||||||
cfg.addAnnotatedClass( Student.class );
|
cfg.addAnnotatedClass( Student.class );
|
||||||
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
||||||
try {
|
try {
|
||||||
final EntityPersister entityPersister = factory.getEntityPersister( classUnderTest.getName() );
|
final EntityPersister entityPersister = factory.getMetamodel().entityPersister(classUnderTest.getName());
|
||||||
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
||||||
|
|
||||||
assertTrue(
|
assertTrue(
|
||||||
|
@ -199,7 +185,7 @@ public class AccessMappingTest {
|
||||||
cfg.addAnnotatedClass( Student.class );
|
cfg.addAnnotatedClass( Student.class );
|
||||||
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
||||||
try {
|
try {
|
||||||
final EntityPersister entityPersister = factory.getEntityPersister( classUnderTest.getName() );
|
final EntityPersister entityPersister = factory.getMetamodel().entityPersister(classUnderTest.getName());
|
||||||
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
||||||
|
|
||||||
assertTrue(
|
assertTrue(
|
||||||
|
@ -226,7 +212,7 @@ public class AccessMappingTest {
|
||||||
cfg.addAnnotatedClass( Being.class );
|
cfg.addAnnotatedClass( Being.class );
|
||||||
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
||||||
try {
|
try {
|
||||||
final EntityPersister entityPersister = factory.getEntityPersister( classUnderTest.getName() );
|
final EntityPersister entityPersister = factory.getMetamodel().entityPersister(classUnderTest.getName());
|
||||||
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
||||||
|
|
||||||
assertTrue(
|
assertTrue(
|
||||||
|
@ -247,7 +233,7 @@ public class AccessMappingTest {
|
||||||
|
|
||||||
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory( serviceRegistry );
|
||||||
try {
|
try {
|
||||||
EntityPersister entityPersister = factory.getEntityPersister( Animal.class.getName() );
|
EntityPersister entityPersister = factory.getMetamodel().entityPersister(Animal.class.getName());
|
||||||
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
final BasicEntityIdentifierMappingImpl identifierMapping = (BasicEntityIdentifierMappingImpl) entityPersister.getIdentifierMapping();
|
||||||
|
|
||||||
assertTrue(
|
assertTrue(
|
||||||
|
@ -255,7 +241,7 @@ public class AccessMappingTest {
|
||||||
identifierMapping.getPropertyAccess().getGetter() instanceof GetterMethodImpl
|
identifierMapping.getPropertyAccess().getGetter() instanceof GetterMethodImpl
|
||||||
);
|
);
|
||||||
|
|
||||||
entityPersister = factory.getEntityPersister( Horse.class.getName() );
|
entityPersister = factory.getMetamodel().entityPersister(Horse.class.getName());
|
||||||
|
|
||||||
assertTrue(
|
assertTrue(
|
||||||
"Field access should be used since the default access mode gets inherited",
|
"Field access should be used since the default access mode gets inherited",
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class CollectionCacheEvictionTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCachedValueAfterEviction() {
|
public void testCachedValueAfterEviction() {
|
||||||
CollectionPersister persister = sessionFactory().getCollectionPersister( Company.class.getName() + ".users" );
|
CollectionPersister persister = sessionFactory().getMetamodel().collectionPersister(Company.class.getName() + ".users");
|
||||||
|
|
||||||
Session session = openSession();
|
Session session = openSession();
|
||||||
SessionImplementor sessionImplementor = (SessionImplementor) session;
|
SessionImplementor sessionImplementor = (SessionImplementor) session;
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class UnversionedCascadeDereferencedCollectionTest extends AbstractDerefe
|
||||||
assertNotNull( ceManiesOrig );
|
assertNotNull( ceManiesOrig );
|
||||||
assertEquals( role, ceManiesOrig.getRole() );
|
assertEquals( role, ceManiesOrig.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManiesOrig.getLoadedPersister()
|
ceManiesOrig.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
||||||
|
@ -178,7 +178,7 @@ public class UnversionedCascadeDereferencedCollectionTest extends AbstractDerefe
|
||||||
assertNotNull( ceManies );
|
assertNotNull( ceManies );
|
||||||
assertEquals( role, ceManies.getRole() );
|
assertEquals( role, ceManies.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManies.getLoadedPersister()
|
ceManies.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManies.getKey() );
|
assertEquals( one.getId(), ceManies.getKey() );
|
||||||
|
@ -262,7 +262,7 @@ public class UnversionedCascadeDereferencedCollectionTest extends AbstractDerefe
|
||||||
assertNotNull( ceManiesOrig );
|
assertNotNull( ceManiesOrig );
|
||||||
assertEquals( role, ceManiesOrig.getRole() );
|
assertEquals( role, ceManiesOrig.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManiesOrig.getLoadedPersister()
|
ceManiesOrig.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
||||||
|
@ -305,7 +305,7 @@ public class UnversionedCascadeDereferencedCollectionTest extends AbstractDerefe
|
||||||
assertNotNull( ceManiesAfterReplace );
|
assertNotNull( ceManiesAfterReplace );
|
||||||
assertEquals( role, ceManiesAfterReplace.getRole() );
|
assertEquals( role, ceManiesAfterReplace.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManiesAfterReplace.getLoadedPersister()
|
ceManiesAfterReplace.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManiesAfterReplace.getKey() );
|
assertEquals( one.getId(), ceManiesAfterReplace.getKey() );
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class UnversionedNoCascadeDereferencedCollectionTest extends AbstractDere
|
||||||
assertNotNull( ceManiesOrig );
|
assertNotNull( ceManiesOrig );
|
||||||
assertEquals( role, ceManiesOrig.getRole() );
|
assertEquals( role, ceManiesOrig.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManiesOrig.getLoadedPersister()
|
ceManiesOrig.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
||||||
|
@ -175,7 +175,7 @@ public class UnversionedNoCascadeDereferencedCollectionTest extends AbstractDere
|
||||||
assertNotNull( ceManies );
|
assertNotNull( ceManies );
|
||||||
assertEquals( role, ceManies.getRole() );
|
assertEquals( role, ceManies.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManies.getLoadedPersister()
|
ceManies.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManies.getKey() );
|
assertEquals( one.getId(), ceManies.getKey() );
|
||||||
|
@ -258,7 +258,7 @@ public class UnversionedNoCascadeDereferencedCollectionTest extends AbstractDere
|
||||||
assertNotNull( ceManiesOrig );
|
assertNotNull( ceManiesOrig );
|
||||||
assertEquals( role, ceManiesOrig.getRole() );
|
assertEquals( role, ceManiesOrig.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManiesOrig.getLoadedPersister()
|
ceManiesOrig.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
||||||
|
@ -301,7 +301,7 @@ public class UnversionedNoCascadeDereferencedCollectionTest extends AbstractDere
|
||||||
assertNotNull( ceManiesAfterReplace );
|
assertNotNull( ceManiesAfterReplace );
|
||||||
assertEquals( role, ceManiesAfterReplace.getRole() );
|
assertEquals( role, ceManiesAfterReplace.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManiesAfterReplace.getLoadedPersister()
|
ceManiesAfterReplace.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManiesAfterReplace.getKey() );
|
assertEquals( one.getId(), ceManiesAfterReplace.getKey() );
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class VersionedCascadeDereferencedCollectionTest extends AbstractDerefere
|
||||||
assertNotNull( ceManiesOrig );
|
assertNotNull( ceManiesOrig );
|
||||||
assertEquals( role, ceManiesOrig.getRole() );
|
assertEquals( role, ceManiesOrig.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManiesOrig.getLoadedPersister()
|
ceManiesOrig.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
||||||
|
@ -175,7 +175,7 @@ public class VersionedCascadeDereferencedCollectionTest extends AbstractDerefere
|
||||||
assertNotNull( ceManies );
|
assertNotNull( ceManies );
|
||||||
assertEquals( role, ceManies.getRole() );
|
assertEquals( role, ceManies.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManies.getLoadedPersister()
|
ceManies.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManies.getKey() );
|
assertEquals( one.getId(), ceManies.getKey() );
|
||||||
|
@ -255,7 +255,7 @@ public class VersionedCascadeDereferencedCollectionTest extends AbstractDerefere
|
||||||
assertNotNull( ceManiesOrig );
|
assertNotNull( ceManiesOrig );
|
||||||
assertEquals( role, ceManiesOrig.getRole() );
|
assertEquals( role, ceManiesOrig.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManiesOrig.getLoadedPersister()
|
ceManiesOrig.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
||||||
|
@ -298,7 +298,7 @@ public class VersionedCascadeDereferencedCollectionTest extends AbstractDerefere
|
||||||
assertNotNull( ceManiesAfterReplace );
|
assertNotNull( ceManiesAfterReplace );
|
||||||
assertEquals( role, ceManiesAfterReplace.getRole() );
|
assertEquals( role, ceManiesAfterReplace.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManiesAfterReplace.getLoadedPersister()
|
ceManiesAfterReplace.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManiesAfterReplace.getKey() );
|
assertEquals( one.getId(), ceManiesAfterReplace.getKey() );
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class VersionedNoCascadeDereferencedCollectionTest extends AbstractDerefe
|
||||||
assertNotNull( ceManiesOrig );
|
assertNotNull( ceManiesOrig );
|
||||||
assertEquals( role, ceManiesOrig.getRole() );
|
assertEquals( role, ceManiesOrig.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManiesOrig.getLoadedPersister()
|
ceManiesOrig.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
||||||
|
@ -177,7 +177,7 @@ public class VersionedNoCascadeDereferencedCollectionTest extends AbstractDerefe
|
||||||
assertNotNull( ceManies );
|
assertNotNull( ceManies );
|
||||||
assertEquals( role, ceManies.getRole() );
|
assertEquals( role, ceManies.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManies.getLoadedPersister()
|
ceManies.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManies.getKey() );
|
assertEquals( one.getId(), ceManies.getKey() );
|
||||||
|
@ -261,7 +261,7 @@ public class VersionedNoCascadeDereferencedCollectionTest extends AbstractDerefe
|
||||||
assertNotNull( ceManiesOrig );
|
assertNotNull( ceManiesOrig );
|
||||||
assertEquals( role, ceManiesOrig.getRole() );
|
assertEquals( role, ceManiesOrig.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManiesOrig.getLoadedPersister()
|
ceManiesOrig.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
assertEquals( one.getId(), ceManiesOrig.getKey() );
|
||||||
|
@ -304,7 +304,7 @@ public class VersionedNoCascadeDereferencedCollectionTest extends AbstractDerefe
|
||||||
assertNotNull( ceManiesAfterReplace );
|
assertNotNull( ceManiesAfterReplace );
|
||||||
assertEquals( role, ceManiesAfterReplace.getRole() );
|
assertEquals( role, ceManiesAfterReplace.getRole() );
|
||||||
assertSame(
|
assertSame(
|
||||||
scope.getSessionFactory().getCollectionPersister( role ),
|
scope.getSessionFactory().getMetamodel().collectionPersister(role),
|
||||||
ceManiesAfterReplace.getLoadedPersister()
|
ceManiesAfterReplace.getLoadedPersister()
|
||||||
);
|
);
|
||||||
assertEquals( one.getId(), ceManiesAfterReplace.getKey() );
|
assertEquals( one.getId(), ceManiesAfterReplace.getKey() );
|
||||||
|
|
|
@ -45,8 +45,7 @@ public class PersistentListTest {
|
||||||
public void testInverseListIndex(SessionFactoryScope scope) {
|
public void testInverseListIndex(SessionFactoryScope scope) {
|
||||||
// make sure no one changes the mapping
|
// make sure no one changes the mapping
|
||||||
SessionFactoryImplementor sessionFactory = scope.getSessionFactory();
|
SessionFactoryImplementor sessionFactory = scope.getSessionFactory();
|
||||||
final CollectionPersister collectionPersister = sessionFactory
|
final CollectionPersister collectionPersister = sessionFactory.getMetamodel().collectionPersister(ListOwner.class.getName() + ".children");
|
||||||
.getCollectionPersister( ListOwner.class.getName() + ".children" );
|
|
||||||
assertTrue( collectionPersister.isInverse() );
|
assertTrue( collectionPersister.isInverse() );
|
||||||
|
|
||||||
// do some creations...
|
// do some creations...
|
||||||
|
@ -110,8 +109,7 @@ public class PersistentListTest {
|
||||||
public void testInverseListIndex2(SessionFactoryScope scope) {
|
public void testInverseListIndex2(SessionFactoryScope scope) {
|
||||||
// make sure no one changes the mapping
|
// make sure no one changes the mapping
|
||||||
SessionFactoryImplementor sessionFactory = scope.getSessionFactory();
|
SessionFactoryImplementor sessionFactory = scope.getSessionFactory();
|
||||||
final CollectionPersister collectionPersister = sessionFactory
|
final CollectionPersister collectionPersister = sessionFactory.getMetamodel().collectionPersister(Order.class.getName() + ".lineItems");
|
||||||
.getCollectionPersister( Order.class.getName() + ".lineItems" );
|
|
||||||
assertTrue( collectionPersister.isInverse() );
|
assertTrue( collectionPersister.isInverse() );
|
||||||
|
|
||||||
// do some creations...
|
// do some creations...
|
||||||
|
|
|
@ -172,13 +172,13 @@ public class BatchFetchStrategyHelperTest extends BaseCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private org.hibernate.FetchMode determineFetchMode(Class<?> entityClass, String path) {
|
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 );
|
int index = ( (UniqueKeyLoadable) entityPersister ).getPropertyIndex( path );
|
||||||
return entityPersister.getFetchMode( index );
|
return entityPersister.getFetchMode( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
private AssociationType determineAssociationType(Class<?> entityClass, String path) {
|
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 );
|
int index = ( (UniqueKeyLoadable) entityPersister ).getPropertyIndex( path );
|
||||||
return (AssociationType) entityPersister.getSubclassPropertyType( index );
|
return (AssociationType) entityPersister.getSubclassPropertyType( index );
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,13 +168,13 @@ public class FetchStrategyHelperTest extends BaseCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private org.hibernate.FetchMode determineFetchMode(Class<?> entityClass, String path) {
|
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 );
|
int index = ( (UniqueKeyLoadable) entityPersister ).getPropertyIndex( path );
|
||||||
return entityPersister.getFetchMode( index );
|
return entityPersister.getFetchMode( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
private AssociationType determineAssociationType(Class<?> entityClass, String path) {
|
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 );
|
int index = ( (UniqueKeyLoadable) entityPersister ).getPropertyIndex( path );
|
||||||
return (AssociationType) entityPersister.getSubclassPropertyType( index );
|
return (AssociationType) entityPersister.getSubclassPropertyType( index );
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,13 +90,13 @@ public class NoProxyFetchStrategyHelperTest extends BaseCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private org.hibernate.FetchMode determineFetchMode(Class<?> entityClass, String path) {
|
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 );
|
int index = ( (UniqueKeyLoadable) entityPersister ).getPropertyIndex( path );
|
||||||
return entityPersister.getFetchMode( index );
|
return entityPersister.getFetchMode( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
private AssociationType determineAssociationType(Class<?> entityClass, String path) {
|
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 );
|
int index = ( (UniqueKeyLoadable) entityPersister ).getPropertyIndex( path );
|
||||||
return (AssociationType) entityPersister.getSubclassPropertyType( index );
|
return (AssociationType) entityPersister.getSubclassPropertyType( index );
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class DynamicFilterTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testSecondLevelCachedCollectionsFiltering() {
|
public void testSecondLevelCachedCollectionsFiltering() {
|
||||||
|
|
||||||
CollectionPersister persister = sessionFactory().getCollectionPersister( Salesperson.class.getName() + ".orders" );
|
CollectionPersister persister = sessionFactory().getMetamodel().collectionPersister(Salesperson.class.getName() + ".orders");
|
||||||
CollectionDataAccess cache = persister.getCacheAccessStrategy();
|
CollectionDataAccess cache = persister.getCacheAccessStrategy();
|
||||||
|
|
||||||
CollectionCacheEntry cachedData = fromSession(
|
CollectionCacheEntry cachedData = fromSession(
|
||||||
|
|
|
@ -523,7 +523,7 @@ public class BulkManipulationTest extends BaseCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean supportsBulkInsertIdGeneration(Class entityClass) {
|
protected boolean supportsBulkInsertIdGeneration(Class entityClass) {
|
||||||
EntityPersister persister = sessionFactory().getEntityPersister( entityClass.getName() );
|
EntityPersister persister = sessionFactory().getMetamodel().entityPersister(entityClass.getName());
|
||||||
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
||||||
return BulkInsertionCapableIdentifierGenerator.class.isInstance( generator )
|
return BulkInsertionCapableIdentifierGenerator.class.isInstance( generator )
|
||||||
&& BulkInsertionCapableIdentifierGenerator.class.cast( generator )
|
&& BulkInsertionCapableIdentifierGenerator.class.cast( generator )
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
package org.hibernate.orm.test.idgen.enhanced.forcedtable;
|
package org.hibernate.orm.test.idgen.enhanced.forcedtable;
|
||||||
|
|
||||||
|
|
||||||
import org.hibernate.Session;
|
|
||||||
import org.hibernate.id.IdentifierGeneratorHelper.BasicHolder;
|
import org.hibernate.id.IdentifierGeneratorHelper.BasicHolder;
|
||||||
import org.hibernate.id.enhanced.NoopOptimizer;
|
import org.hibernate.id.enhanced.NoopOptimizer;
|
||||||
import org.hibernate.id.enhanced.SequenceStyleGenerator;
|
import org.hibernate.id.enhanced.SequenceStyleGenerator;
|
||||||
|
@ -34,7 +33,7 @@ public class BasicForcedTableSequenceTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNormalBoundary(SessionFactoryScope scope) {
|
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 ) );
|
assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) );
|
||||||
|
|
||||||
final SequenceStyleGenerator generator = ( SequenceStyleGenerator ) persister.getIdentifierGenerator();
|
final SequenceStyleGenerator generator = ( SequenceStyleGenerator ) persister.getIdentifierGenerator();
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class HiLoForcedTableSequenceTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNormalBoundary(SessionFactoryScope scope) {
|
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 ) );
|
assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) );
|
||||||
|
|
||||||
final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator();
|
final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator();
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class PooledForcedTableSequenceTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNormalBoundary(SessionFactoryScope scope) {
|
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 ) );
|
assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) );
|
||||||
|
|
||||||
final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator();
|
final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator();
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.orm.test.idgen.enhanced.sequence;
|
package org.hibernate.orm.test.idgen.enhanced.sequence;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
|
||||||
import org.hibernate.id.IdentifierGeneratorHelper.BasicHolder;
|
import org.hibernate.id.IdentifierGeneratorHelper.BasicHolder;
|
||||||
import org.hibernate.id.enhanced.SequenceStyleGenerator;
|
import org.hibernate.id.enhanced.SequenceStyleGenerator;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
@ -20,7 +19,6 @@ import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.instanceOf;
|
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.assertEquals;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
|
@ -39,7 +37,7 @@ public class BasicSequenceTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNormalBoundary(SessionFactoryScope scope) {
|
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 ) );
|
assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) );
|
||||||
|
|
||||||
final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator();
|
final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator();
|
||||||
|
@ -68,7 +66,7 @@ public class BasicSequenceTest {
|
||||||
public void testSequencePerEntity(SessionFactoryScope scope) {
|
public void testSequencePerEntity(SessionFactoryScope scope) {
|
||||||
final String overriddenEntityName = "SpecialEntity";
|
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 ) );
|
assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) );
|
||||||
|
|
||||||
final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator();
|
final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator();
|
||||||
|
|
|
@ -17,7 +17,6 @@ import jakarta.persistence.Id;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
import org.hibernate.annotations.Parameter;
|
import org.hibernate.annotations.Parameter;
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.dialect.DerbyDialect;
|
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
||||||
import org.hibernate.id.enhanced.HiLoOptimizer;
|
import org.hibernate.id.enhanced.HiLoOptimizer;
|
||||||
|
@ -94,7 +93,7 @@ public class HiLoSequenceMismatchStrategyTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSequenceMismatchStrategyNotApplied(SessionFactoryScope scope) {
|
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 ) );
|
assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) );
|
||||||
|
|
||||||
final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator();
|
final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator();
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class HiLoSequenceTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNormalBoundary(SessionFactoryScope scope) {
|
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 ) );
|
assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) );
|
||||||
|
|
||||||
final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator();
|
final SequenceStyleGenerator generator = (SequenceStyleGenerator) persister.getIdentifierGenerator();
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class PooledSequenceTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNormalBoundary(SessionFactoryScope scope) {
|
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 ) );
|
assertThat( persister.getIdentifierGenerator(), instanceOf( SequenceStyleGenerator.class ) );
|
||||||
|
|
||||||
final SequenceStyleGenerator generator = ( SequenceStyleGenerator ) persister.getIdentifierGenerator();
|
final SequenceStyleGenerator generator = ( SequenceStyleGenerator ) persister.getIdentifierGenerator();
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class BasicTableTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNormalBoundary(SessionFactoryScope scope) {
|
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 ) );
|
assertThat( persister.getIdentifierGenerator(), instanceOf( TableGenerator.class ) );
|
||||||
|
|
||||||
final TableGenerator generator = ( TableGenerator ) persister.getIdentifierGenerator();
|
final TableGenerator generator = ( TableGenerator ) persister.getIdentifierGenerator();
|
||||||
|
|
|
@ -26,7 +26,7 @@ import static org.junit.Assert.assertThat;
|
||||||
public class HiLoTableTest {
|
public class HiLoTableTest {
|
||||||
@Test
|
@Test
|
||||||
public void testNormalBoundary(SessionFactoryScope scope) {
|
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 ) );
|
assertThat( persister.getIdentifierGenerator(), instanceOf( TableGenerator.class ) );
|
||||||
|
|
||||||
final TableGenerator generator = (TableGenerator) persister.getIdentifierGenerator();
|
final TableGenerator generator = (TableGenerator) persister.getIdentifierGenerator();
|
||||||
|
|
|
@ -26,7 +26,7 @@ import static org.junit.Assert.assertThat;
|
||||||
public class PooledTableTest {
|
public class PooledTableTest {
|
||||||
@Test
|
@Test
|
||||||
public void testNormalBoundary(SessionFactoryScope scope) {
|
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 ) );
|
assertThat( persister.getIdentifierGenerator(), instanceOf( TableGenerator.class ) );
|
||||||
|
|
||||||
final TableGenerator generator = (TableGenerator) persister.getIdentifierGenerator();
|
final TableGenerator generator = (TableGenerator) persister.getIdentifierGenerator();
|
||||||
|
|
|
@ -56,8 +56,8 @@ public abstract class AbstractEntityWithManyToManyTest {
|
||||||
catch (IllegalArgumentException ex) {
|
catch (IllegalArgumentException ex) {
|
||||||
isPlanContractsBidirectional = false;
|
isPlanContractsBidirectional = false;
|
||||||
}
|
}
|
||||||
isPlanVersioned = sessionFactory.getEntityPersister( Plan.class.getName() ).isVersioned();
|
isPlanVersioned = sessionFactory.getMetamodel().entityPersister(Plan.class.getName()).isVersioned();
|
||||||
isContractVersioned = sessionFactory.getEntityPersister( Contract.class.getName() ).isVersioned();
|
isContractVersioned = sessionFactory.getMetamodel().entityPersister(Contract.class.getName()).isVersioned();
|
||||||
sessionFactory.getStatistics().clear();
|
sessionFactory.getStatistics().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,14 +45,14 @@ public class JoinedSubclassWithExplicitDiscriminatorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void metadataAssertions(SessionFactoryScope scope) {
|
public void metadataAssertions(SessionFactoryScope scope) {
|
||||||
EntityPersister p = scope.getSessionFactory().getEntityPersister( Dog.class.getName() );
|
EntityPersister p = scope.getSessionFactory().getMetamodel().entityPersister(Dog.class.getName());
|
||||||
assertNotNull( p );
|
assertNotNull( p );
|
||||||
final JoinedSubclassEntityPersister dogPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
final JoinedSubclassEntityPersister dogPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
||||||
assertEquals( "string", dogPersister.getDiscriminatorType().getName() );
|
assertEquals( "string", dogPersister.getDiscriminatorType().getName() );
|
||||||
assertEquals( "type", dogPersister.getDiscriminatorColumnName() );
|
assertEquals( "type", dogPersister.getDiscriminatorColumnName() );
|
||||||
assertEquals( "dog", dogPersister.getDiscriminatorValue() );
|
assertEquals( "dog", dogPersister.getDiscriminatorValue() );
|
||||||
|
|
||||||
p = scope.getSessionFactory().getEntityPersister( Cat.class.getName() );
|
p = scope.getSessionFactory().getMetamodel().entityPersister(Cat.class.getName());
|
||||||
assertNotNull( p );
|
assertNotNull( p );
|
||||||
final JoinedSubclassEntityPersister catPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
final JoinedSubclassEntityPersister catPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
||||||
assertEquals( "string", catPersister.getDiscriminatorType().getName() );
|
assertEquals( "string", catPersister.getDiscriminatorType().getName() );
|
||||||
|
|
|
@ -54,14 +54,14 @@ public class JoinedSubclassWithIgnoredExplicitDiscriminatorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void metadataAssertions(SessionFactoryScope scope) {
|
public void metadataAssertions(SessionFactoryScope scope) {
|
||||||
EntityPersister p = scope.getSessionFactory().getEntityPersister( Dog.class.getName() );
|
EntityPersister p = scope.getSessionFactory().getMetamodel().entityPersister(Dog.class.getName());
|
||||||
assertNotNull( p );
|
assertNotNull( p );
|
||||||
final JoinedSubclassEntityPersister dogPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
final JoinedSubclassEntityPersister dogPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
||||||
assertEquals( "integer", dogPersister.getDiscriminatorType().getName() );
|
assertEquals( "integer", dogPersister.getDiscriminatorType().getName() );
|
||||||
assertEquals( "clazz_", dogPersister.getDiscriminatorColumnName() );
|
assertEquals( "clazz_", dogPersister.getDiscriminatorColumnName() );
|
||||||
assertTrue( Integer.class.isInstance( dogPersister.getDiscriminatorValue() ) );
|
assertTrue( Integer.class.isInstance( dogPersister.getDiscriminatorValue() ) );
|
||||||
|
|
||||||
p = scope.getSessionFactory().getEntityPersister( Cat.class.getName() );
|
p = scope.getSessionFactory().getMetamodel().entityPersister(Cat.class.getName());
|
||||||
assertNotNull( p );
|
assertNotNull( p );
|
||||||
final JoinedSubclassEntityPersister catPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
final JoinedSubclassEntityPersister catPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
||||||
assertEquals( "integer", catPersister.getDiscriminatorType().getName() );
|
assertEquals( "integer", catPersister.getDiscriminatorType().getName() );
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class JoinedSubclassWithImplicitDiscriminatorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void metadataAssertions(SessionFactoryScope scope) {
|
public void metadataAssertions(SessionFactoryScope scope) {
|
||||||
EntityPersister p = scope.getSessionFactory().getEntityPersister( Dog.class.getName() );
|
EntityPersister p = scope.getSessionFactory().getMetamodel().entityPersister(Dog.class.getName());
|
||||||
assertNotNull( p );
|
assertNotNull( p );
|
||||||
final JoinedSubclassEntityPersister dogPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
final JoinedSubclassEntityPersister dogPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
@ -63,7 +63,7 @@ public class JoinedSubclassWithImplicitDiscriminatorTest {
|
||||||
);
|
);
|
||||||
assertEquals( "Dog", dogPersister.getDiscriminatorValue() );
|
assertEquals( "Dog", dogPersister.getDiscriminatorValue() );
|
||||||
|
|
||||||
p = scope.getSessionFactory().getEntityPersister( Cat.class.getName() );
|
p = scope.getSessionFactory().getMetamodel().entityPersister(Cat.class.getName());
|
||||||
assertNotNull( p );
|
assertNotNull( p );
|
||||||
final JoinedSubclassEntityPersister catPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
final JoinedSubclassEntityPersister catPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class BasicJodaTimeConversionTest extends BaseNonConfigCoreFunctionalTest
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleConvertUsage() throws MalformedURLException {
|
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 Type theDatePropertyType = ep.getPropertyType( "theDate" );
|
||||||
final AttributeConverterTypeAdapter type = assertTyping( AttributeConverterTypeAdapter.class, theDatePropertyType );
|
final AttributeConverterTypeAdapter type = assertTyping( AttributeConverterTypeAdapter.class, theDatePropertyType );
|
||||||
assertTrue( JodaLocalDateConverter.class.isAssignableFrom( type.getAttributeConverter().getConverterJavaType().getJavaTypeClass() ) );
|
assertTrue( JodaLocalDateConverter.class.isAssignableFrom( type.getAttributeConverter().getConverterJavaType().getJavaTypeClass() ) );
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class DirtyCheckingTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkConverterMutabilityPlans() {
|
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 numberMapping = persister.findAttributeMapping( "number" );
|
||||||
final AttributeMapping nameMapping = persister.findAttributeMapping( "name" );
|
final AttributeMapping nameMapping = persister.findAttributeMapping( "name" );
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class ExplicitDateConvertersTest extends BaseNonConfigCoreFunctionalTestC
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleConvertUsage() throws MalformedURLException {
|
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 Type theDatePropertyType = ep.getPropertyType( "theDate" );
|
||||||
final AttributeConverterTypeAdapter type = assertTyping(
|
final AttributeConverterTypeAdapter type = assertTyping(
|
||||||
AttributeConverterTypeAdapter.class,
|
AttributeConverterTypeAdapter.class,
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class ExplicitEnumConvertersTest extends BaseNonConfigCoreFunctionalTestC
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleConvertUsage() throws MalformedURLException {
|
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 Type theDatePropertyType = ep.getPropertyType( "mediaType" );
|
||||||
final AttributeConverterTypeAdapter type = assertTyping(
|
final AttributeConverterTypeAdapter type = assertTyping(
|
||||||
AttributeConverterTypeAdapter.class,
|
AttributeConverterTypeAdapter.class,
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class SimpleConvertAnnotationTest extends BaseNonConfigCoreFunctionalTest
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleConvertUsage() throws MalformedURLException {
|
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 Type websitePropertyType = ep.getPropertyType( "website" );
|
||||||
final AttributeConverterTypeAdapter type = assertTyping(
|
final AttributeConverterTypeAdapter type = assertTyping(
|
||||||
AttributeConverterTypeAdapter.class,
|
AttributeConverterTypeAdapter.class,
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SimpleConvertsAnnotationTest extends BaseNonConfigCoreFunctionalTes
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleConvertsUsage() throws MalformedURLException {
|
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 Type websitePropertyType = ep.getPropertyType( "website" );
|
||||||
final AttributeConverterTypeAdapter type = assertTyping(
|
final AttributeConverterTypeAdapter type = assertTyping(
|
||||||
AttributeConverterTypeAdapter.class,
|
AttributeConverterTypeAdapter.class,
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class SimpleEmbeddableOverriddenConverterTest extends BaseNonConfigCoreFu
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleConvertOverrides() {
|
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()
|
final JdbcTypeRegistry jdbcTypeRegistry = sessionFactory().getTypeConfiguration()
|
||||||
.getJdbcTypeRegistry();
|
.getJdbcTypeRegistry();
|
||||||
CompositeType homeAddressType = assertTyping( CompositeType.class, ep.getPropertyType( "homeAddress" ) );
|
CompositeType homeAddressType = assertTyping( CompositeType.class, ep.getPropertyType( "homeAddress" ) );
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class SimpleOverriddenConverterTest extends BaseNonConfigCoreFunctionalTe
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleConvertOverrides() {
|
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()
|
final JdbcTypeRegistry jdbcTypeRegistry = sessionFactory().getTypeConfiguration()
|
||||||
.getJdbcTypeRegistry();
|
.getJdbcTypeRegistry();
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class XmlWithExplicitConvertAnnotationsTest extends BaseNonConfigCoreFunc
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleConvertUsage() throws MalformedURLException {
|
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 Type theDatePropertyType = ep.getPropertyType( "theDate" );
|
||||||
final AttributeConverterTypeAdapter type = assertTyping(
|
final AttributeConverterTypeAdapter type = assertTyping(
|
||||||
AttributeConverterTypeAdapter.class,
|
AttributeConverterTypeAdapter.class,
|
||||||
|
|
|
@ -162,7 +162,7 @@ public class CacheLazyLoadNoTransTest {
|
||||||
Object value = scope.fromSession(
|
Object value = scope.fromSession(
|
||||||
session -> {
|
session -> {
|
||||||
final SessionFactoryImplementor sessionFactory = scope.getSessionFactory();
|
final SessionFactoryImplementor sessionFactory = scope.getSessionFactory();
|
||||||
CollectionPersister persister = sessionFactory.getCollectionPersister( entityClass.getName() + "." + attr );
|
CollectionPersister persister = sessionFactory.getMetamodel().collectionPersister(entityClass.getName() + "." + attr);
|
||||||
CollectionDataAccess cache = persister.getCacheAccessStrategy();
|
CollectionDataAccess cache = persister.getCacheAccessStrategy();
|
||||||
Object key = cache.generateCacheKey( id, persister, sessionFactory, session.getTenantIdentifier() );
|
Object key = cache.generateCacheKey( id, persister, sessionFactory, session.getTenantIdentifier() );
|
||||||
Object cachedValue = cache.get( session, key );
|
Object cachedValue = cache.get( session, key );
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class CustomSqlSchemaResolvingIdentityTest {
|
||||||
|
|
||||||
String className = CustomEntity.class.getName();
|
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 insertQuery = persister.getSQLInsertStrings()[0];
|
||||||
String updateQuery = persister.getSQLUpdateStrings()[0];
|
String updateQuery = persister.getSQLUpdateStrings()[0];
|
||||||
String deleteQuery = persister.getSQLDeleteStrings()[0];
|
String deleteQuery = persister.getSQLDeleteStrings()[0];
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class CustomSqlSchemaResolvingTest {
|
||||||
|
|
||||||
String className = CustomEntity.class.getName();
|
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 insertQuery = persister.getSQLInsertStrings()[0];
|
||||||
String updateQuery = persister.getSQLUpdateStrings()[0];
|
String updateQuery = persister.getSQLUpdateStrings()[0];
|
||||||
String deleteQuery = persister.getSQLDeleteStrings()[0];
|
String deleteQuery = persister.getSQLDeleteStrings()[0];
|
||||||
|
|
|
@ -485,7 +485,7 @@ public class ProxyTest extends BaseCoreFunctionalTestCase {
|
||||||
SessionImpl sImpl = ( SessionImpl ) s;
|
SessionImpl sImpl = ( SessionImpl ) s;
|
||||||
sImpl.getPersistenceContext().getDatabaseSnapshot(
|
sImpl.getPersistenceContext().getDatabaseSnapshot(
|
||||||
lastContainerId,
|
lastContainerId,
|
||||||
sImpl.getFactory().getEntityPersister( Container.class.getName() )
|
sImpl.getFactory().getMetamodel().entityPersister(Container.class.getName())
|
||||||
);
|
);
|
||||||
assertFalse( Hibernate.isInitialized( proxy ) );
|
assertFalse( Hibernate.isInitialized( proxy ) );
|
||||||
t.commit();
|
t.commit();
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SybaseTimestampComparisonAnnotationsTest extends BaseCoreFunctional
|
||||||
@TestForIssue( jiraKey = "HHH-10413" )
|
@TestForIssue( jiraKey = "HHH-10413" )
|
||||||
public void testComparableTimestamps() {
|
public void testComparableTimestamps() {
|
||||||
final BasicType<?> versionType =
|
final BasicType<?> versionType =
|
||||||
sessionFactory().getEntityPersister( Thing.class.getName() ).getVersionType();
|
sessionFactory().getMetamodel().entityPersister(Thing.class.getName()).getVersionType();
|
||||||
assertTrue( versionType.getJavaTypeDescriptor() instanceof PrimitiveByteArrayJavaType );
|
assertTrue( versionType.getJavaTypeDescriptor() instanceof PrimitiveByteArrayJavaType );
|
||||||
assertTrue( versionType.getJdbcType() instanceof VarbinaryJdbcType );
|
assertTrue( versionType.getJdbcType() instanceof VarbinaryJdbcType );
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@ public class SybaseTimestampVersioningTest extends BaseCoreFunctionalTestCase {
|
||||||
@TestForIssue( jiraKey = "HHH-10413" )
|
@TestForIssue( jiraKey = "HHH-10413" )
|
||||||
public void testComparableTimestamps() {
|
public void testComparableTimestamps() {
|
||||||
final BasicType<?> versionType =
|
final BasicType<?> versionType =
|
||||||
sessionFactory().getEntityPersister( User.class.getName() ).getVersionType();
|
sessionFactory().getMetamodel().entityPersister(User.class.getName()).getVersionType();
|
||||||
assertTrue( versionType.getJavaTypeDescriptor() instanceof PrimitiveByteArrayJavaType );
|
assertTrue( versionType.getJavaTypeDescriptor() instanceof PrimitiveByteArrayJavaType );
|
||||||
assertTrue( versionType.getJdbcType() instanceof VarbinaryJdbcType );
|
assertTrue( versionType.getJdbcType() instanceof VarbinaryJdbcType );
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
assertEquals( 0, sessionFactory().getStatistics().getUpdateTimestampsCacheHitCount() );
|
assertEquals( 0, sessionFactory().getStatistics().getUpdateTimestampsCacheHitCount() );
|
||||||
assertEquals( 0, sessionFactory().getStatistics().getUpdateTimestampsCachePutCount() );
|
assertEquals( 0, sessionFactory().getStatistics().getUpdateTimestampsCachePutCount() );
|
||||||
assertEquals( 0, sessionFactory().getStatistics().getUpdateTimestampsCacheMissCount() );
|
assertEquals( 0, sessionFactory().getStatistics().getUpdateTimestampsCacheMissCount() );
|
||||||
assertNotNull( sessionFactory().getEntityPersister( "Item" ).getCacheAccessStrategy() );
|
assertNotNull( sessionFactory().getMetamodel().entityPersister("Item").getCacheAccessStrategy() );
|
||||||
assertEquals( 0, sessionFactory().getStatistics().getEntityLoadCount() );
|
assertEquals( 0, sessionFactory().getStatistics().getEntityLoadCount() );
|
||||||
|
|
||||||
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin();
|
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin();
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class MonotonicRevisionNumberTest extends BaseEnversFunctionalTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOracleSequenceOrder() {
|
public void testOracleSequenceOrder() {
|
||||||
EntityPersister persister = sessionFactory().getEntityPersister( SequenceIdRevisionEntity.class.getName() );
|
EntityPersister persister = sessionFactory().getMetamodel().entityPersister(SequenceIdRevisionEntity.class.getName());
|
||||||
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
||||||
Assert.assertTrue( OrderedSequenceGenerator.class.isInstance( generator ) );
|
Assert.assertTrue( OrderedSequenceGenerator.class.isInstance( generator ) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue