more simplifications to persister hierarchy (#8501)
- remove Lockable interface - remove Queryable, QueryableCollection, and Loadable - remove most of PropertyMapping stuff - remove most of Joinable
This commit is contained in:
parent
f3329fe4e5
commit
ebc253a6f9
|
@ -40,7 +40,7 @@ import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
|
|||
import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtractor;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtractor;
|
||||
import org.hibernate.internal.util.JdbcExceptionHelper;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.query.sqm.IntervalType;
|
||||
import org.hibernate.query.sqm.TemporalUnit;
|
||||
import org.hibernate.sql.ast.SqlAstTranslator;
|
||||
|
@ -317,7 +317,7 @@ public class CacheDialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public LockingStrategy getLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
// InterSystems Cache' does not current support "SELECT ... FOR UPDATE" syntax...
|
||||
// Set your transaction mode to READ_COMMITTED before using
|
||||
switch (lockMode) {
|
||||
|
|
|
@ -51,7 +51,7 @@ import org.hibernate.internal.util.JdbcExceptionHelper;
|
|||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.query.sqm.CastType;
|
||||
import org.hibernate.query.sqm.IntervalType;
|
||||
import org.hibernate.dialect.NullOrdering;
|
||||
|
@ -736,7 +736,7 @@ public class HSQLLegacyDialect extends Dialect {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public LockingStrategy getLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
switch (lockMode) {
|
||||
case PESSIMISTIC_FORCE_INCREMENT:
|
||||
return new PessimisticForceIncrementLockingStrategy( lockable, lockMode);
|
||||
|
@ -758,7 +758,7 @@ public class HSQLLegacyDialect extends Dialect {
|
|||
}
|
||||
|
||||
private static class ReadUncommittedLockingStrategy extends SelectLockingStrategy {
|
||||
private ReadUncommittedLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
private ReadUncommittedLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
super( lockable, lockMode );
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.hibernate.dialect.sequence.SequenceSupport;
|
|||
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.query.sqm.IntervalType;
|
||||
import org.hibernate.query.sqm.TemporalUnit;
|
||||
import org.hibernate.query.sqm.TrimSpec;
|
||||
|
@ -394,7 +394,7 @@ public class RDMSOS2200Dialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public LockingStrategy getLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
// RDMS has no known variation of a "SELECT ... FOR UPDATE" syntax...
|
||||
switch (lockMode) {
|
||||
case PESSIMISTIC_FORCE_INCREMENT:
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
|
|||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.query.sqm.IntervalType;
|
||||
import org.hibernate.query.sqm.TemporalUnit;
|
||||
import org.hibernate.query.sqm.mutation.internal.temptable.GlobalTemporaryTableInsertStrategy;
|
||||
|
@ -370,7 +370,7 @@ public class TimesTenDialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public LockingStrategy getLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
// TimesTen has no known variation of a "SELECT ... FOR UPDATE" syntax...
|
||||
switch ( lockMode ) {
|
||||
case OPTIMISTIC:
|
||||
|
|
|
@ -118,7 +118,7 @@ import org.hibernate.mapping.Table;
|
|||
import org.hibernate.mapping.UserDefinedType;
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.mutation.EntityMutationTarget;
|
||||
import org.hibernate.procedure.internal.StandardCallableStatementSupport;
|
||||
import org.hibernate.procedure.spi.CallableStatementSupport;
|
||||
|
@ -2035,7 +2035,7 @@ public abstract class Dialect implements ConversionContext, TypeContributor, Fun
|
|||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public LockingStrategy getLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
switch ( lockMode ) {
|
||||
case PESSIMISTIC_FORCE_INCREMENT:
|
||||
return new PessimisticForceIncrementLockingStrategy( lockable, lockMode );
|
||||
|
|
|
@ -56,7 +56,7 @@ import org.hibernate.mapping.Table;
|
|||
import org.hibernate.mapping.UserDefinedType;
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.mutation.EntityMutationTarget;
|
||||
import org.hibernate.procedure.spi.CallableStatementSupport;
|
||||
import org.hibernate.query.hql.HqlTranslator;
|
||||
|
@ -401,7 +401,7 @@ public class DialectDelegateWrapper extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public LockingStrategy getLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
return wrapped.getLockingStrategy( lockable, lockMode );
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.hibernate.mapping.Constraint;
|
|||
import org.hibernate.mapping.ForeignKey;
|
||||
import org.hibernate.mapping.Table;
|
||||
import org.hibernate.mapping.UniqueKey;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.query.SemanticException;
|
||||
import org.hibernate.query.sqm.IntervalType;
|
||||
import org.hibernate.query.sqm.TemporalUnit;
|
||||
|
@ -709,7 +709,7 @@ public class SpannerDialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public LockingStrategy getLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
return LOCKING_STRATEGY;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.hibernate.StaleObjectStateException;
|
|||
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.sql.SimpleSelect;
|
||||
import org.hibernate.stat.spi.StatisticsImplementor;
|
||||
|
||||
|
@ -33,17 +33,17 @@ import static org.hibernate.pretty.MessageHelper.infoString;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public abstract class AbstractSelectLockingStrategy implements LockingStrategy {
|
||||
private final Lockable lockable;
|
||||
private final EntityPersister lockable;
|
||||
private final LockMode lockMode;
|
||||
private final String waitForeverSql;
|
||||
|
||||
protected AbstractSelectLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
protected AbstractSelectLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
this.lockable = lockable;
|
||||
this.lockMode = lockMode;
|
||||
this.waitForeverSql = generateLockString( LockOptions.WAIT_FOREVER );
|
||||
}
|
||||
|
||||
protected Lockable getLockable() {
|
||||
protected EntityPersister getLockable() {
|
||||
return lockable;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public abstract class AbstractSelectLockingStrategy implements LockingStrategy {
|
|||
throws StaleObjectStateException, JDBCException {
|
||||
final String sql = determineSql( timeout );
|
||||
final SessionFactoryImplementor factory = session.getFactory();
|
||||
final Lockable lockable = getLockable();
|
||||
final EntityPersister lockable = getLockable();
|
||||
try {
|
||||
final JdbcCoordinator jdbcCoordinator = session.getJdbcCoordinator();
|
||||
final PreparedStatement st = jdbcCoordinator.getStatementPreparer().prepareStatement( sql );
|
||||
|
|
|
@ -9,9 +9,8 @@ package org.hibernate.dialect.lock;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.action.internal.EntityIncrementVersionProcess;
|
||||
import org.hibernate.engine.spi.EntityEntry;
|
||||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
||||
/**
|
||||
* An optimistic locking strategy that verifies that the version
|
||||
|
@ -24,7 +23,7 @@ import org.hibernate.persister.entity.Lockable;
|
|||
* @since 3.5
|
||||
*/
|
||||
public class OptimisticForceIncrementLockingStrategy implements LockingStrategy {
|
||||
private final Lockable lockable;
|
||||
private final EntityPersister lockable;
|
||||
private final LockMode lockMode;
|
||||
|
||||
/**
|
||||
|
@ -33,7 +32,7 @@ public class OptimisticForceIncrementLockingStrategy implements LockingStrategy
|
|||
* @param lockable The metadata for the entity to be locked.
|
||||
* @param lockMode Indicates the type of lock to be acquired.
|
||||
*/
|
||||
public OptimisticForceIncrementLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public OptimisticForceIncrementLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
this.lockable = lockable;
|
||||
this.lockMode = lockMode;
|
||||
if ( lockMode.lessThan( LockMode.OPTIMISTIC_FORCE_INCREMENT ) ) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.LockMode;
|
||||
import org.hibernate.action.internal.EntityVerifyVersionProcess;
|
||||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
||||
/**
|
||||
* An optimistic locking strategy that simply verifies that the
|
||||
|
@ -22,7 +22,7 @@ import org.hibernate.persister.entity.Lockable;
|
|||
* @since 3.5
|
||||
*/
|
||||
public class OptimisticLockingStrategy implements LockingStrategy {
|
||||
private final Lockable lockable;
|
||||
private final EntityPersister lockable;
|
||||
private final LockMode lockMode;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,7 @@ public class OptimisticLockingStrategy implements LockingStrategy {
|
|||
* @param lockable The metadata for the entity to be locked.
|
||||
* @param lockMode Indicates the type of lock to be acquired.
|
||||
*/
|
||||
public OptimisticLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public OptimisticLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
this.lockable = lockable;
|
||||
this.lockMode = lockMode;
|
||||
if ( lockMode.lessThan( LockMode.OPTIMISTIC ) ) {
|
||||
|
|
|
@ -11,7 +11,6 @@ import org.hibernate.LockMode;
|
|||
import org.hibernate.engine.spi.EntityEntry;
|
||||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
|
||||
/**
|
||||
* A pessimistic locking strategy where a lock is obtained by incrementing
|
||||
|
@ -23,7 +22,7 @@ import org.hibernate.persister.entity.Lockable;
|
|||
* @since 3.5
|
||||
*/
|
||||
public class PessimisticForceIncrementLockingStrategy implements LockingStrategy {
|
||||
private final Lockable lockable;
|
||||
private final EntityPersister lockable;
|
||||
private final LockMode lockMode;
|
||||
|
||||
/**
|
||||
|
@ -32,7 +31,7 @@ public class PessimisticForceIncrementLockingStrategy implements LockingStrategy
|
|||
* @param lockable The metadata for the entity to be locked.
|
||||
* @param lockMode Indicates the type of lock to be acquired.
|
||||
*/
|
||||
public PessimisticForceIncrementLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public PessimisticForceIncrementLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
this.lockable = lockable;
|
||||
this.lockMode = lockMode;
|
||||
// ForceIncrement can be used for PESSIMISTIC_READ, PESSIMISTIC_WRITE or PESSIMISTIC_FORCE_INCREMENT
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
||||
/**
|
||||
* A pessimistic locking strategy where {@link LockMode#PESSIMISTIC_READ}
|
||||
|
@ -34,7 +34,7 @@ public class PessimisticReadSelectLockingStrategy extends AbstractSelectLockingS
|
|||
* @param lockable The metadata for the entity to be locked.
|
||||
* @param lockMode Indicates the type of lock to be acquired.
|
||||
*/
|
||||
public PessimisticReadSelectLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public PessimisticReadSelectLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
super( lockable, lockMode );
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
|||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.sql.Update;
|
||||
import org.hibernate.stat.spi.StatisticsImplementor;
|
||||
|
@ -42,7 +42,7 @@ public class PessimisticReadUpdateLockingStrategy implements LockingStrategy {
|
|||
PessimisticReadUpdateLockingStrategy.class.getName()
|
||||
);
|
||||
|
||||
private final Lockable lockable;
|
||||
private final EntityPersister lockable;
|
||||
private final LockMode lockMode;
|
||||
private final String sql;
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class PessimisticReadUpdateLockingStrategy implements LockingStrategy {
|
|||
* @param lockMode Indicates the type of lock to be acquired. Note that
|
||||
* read-locks are not valid for this strategy.
|
||||
*/
|
||||
public PessimisticReadUpdateLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public PessimisticReadUpdateLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
this.lockable = lockable;
|
||||
this.lockMode = lockMode;
|
||||
if ( lockMode.lessThan( LockMode.PESSIMISTIC_READ ) ) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
||||
/**
|
||||
* A pessimistic locking strategy where {@link LockMode#PESSIMISTIC_WRITE}
|
||||
|
@ -33,7 +33,7 @@ public class PessimisticWriteSelectLockingStrategy extends AbstractSelectLocking
|
|||
* @param lockable The metadata for the entity to be locked.
|
||||
* @param lockMode Indicates the type of lock to be acquired.
|
||||
*/
|
||||
public PessimisticWriteSelectLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public PessimisticWriteSelectLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
super( lockable, lockMode );
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
|||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.sql.Update;
|
||||
import org.hibernate.stat.spi.StatisticsImplementor;
|
||||
|
@ -42,7 +42,7 @@ public class PessimisticWriteUpdateLockingStrategy implements LockingStrategy {
|
|||
PessimisticWriteUpdateLockingStrategy.class.getName()
|
||||
);
|
||||
|
||||
private final Lockable lockable;
|
||||
private final EntityPersister lockable;
|
||||
private final LockMode lockMode;
|
||||
private final String sql;
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class PessimisticWriteUpdateLockingStrategy implements LockingStrategy {
|
|||
* @param lockable The metadata for the entity to be locked.
|
||||
* @param lockMode Indicates the type of lock to be acquired. Note that read-locks are not valid for this strategy.
|
||||
*/
|
||||
public PessimisticWriteUpdateLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public PessimisticWriteUpdateLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
this.lockable = lockable;
|
||||
this.lockMode = lockMode;
|
||||
if ( lockMode.lessThan( LockMode.PESSIMISTIC_READ ) ) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
||||
/**
|
||||
* A locking strategy where an optimistic lock is obtained via a select
|
||||
|
@ -33,7 +33,7 @@ public class SelectLockingStrategy extends AbstractSelectLockingStrategy {
|
|||
* @param lockable The metadata for the entity to be locked.
|
||||
* @param lockMode Indicates the type of lock to be acquired.
|
||||
*/
|
||||
public SelectLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public SelectLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
super( lockable, lockMode );
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
|||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.sql.Update;
|
||||
import org.hibernate.stat.spi.StatisticsImplementor;
|
||||
|
@ -40,7 +40,7 @@ public class UpdateLockingStrategy implements LockingStrategy {
|
|||
UpdateLockingStrategy.class.getName()
|
||||
);
|
||||
|
||||
private final Lockable lockable;
|
||||
private final EntityPersister lockable;
|
||||
private final LockMode lockMode;
|
||||
private final String sql;
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class UpdateLockingStrategy implements LockingStrategy {
|
|||
* @param lockMode Indicates the type of lock to be acquired. Note that
|
||||
* read-locks are not valid for this strategy.
|
||||
*/
|
||||
public UpdateLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||
public UpdateLockingStrategy(EntityPersister lockable, LockMode lockMode) {
|
||||
this.lockable = lockable;
|
||||
this.lockMode = lockMode;
|
||||
if ( lockMode.lessThan( LockMode.WRITE ) ) {
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Map;
|
|||
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
||||
/**
|
||||
* @author Rob Worsnop
|
||||
|
@ -76,8 +76,7 @@ public class FilterConfiguration {
|
|||
|
||||
if ( aliasEntityMap != null ) {
|
||||
for ( Map.Entry<String, String> entry : aliasEntityMap.entrySet() ) {
|
||||
final Joinable joinable = (Joinable) factory.getRuntimeMetamodels()
|
||||
.getMappingMetamodel()
|
||||
final EntityPersister joinable = factory.getMappingMetamodel()
|
||||
.getEntityDescriptor( entry.getValue() );
|
||||
ret.put( entry.getKey(), joinable.getTableName() );
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@ import org.hibernate.metamodel.mapping.EntityMappingType;
|
|||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||
import org.hibernate.metamodel.model.domain.NavigableRole;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.collection.mutation.CollectionMutationTarget;
|
||||
import org.hibernate.persister.entity.PropertyMapping;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.sql.ast.spi.FromClauseAccess;
|
||||
import org.hibernate.sql.ast.spi.SqlAliasBase;
|
||||
|
@ -431,8 +429,7 @@ public abstract class AbstractEntityCollectionPart implements EntityCollectionPa
|
|||
targetKeyPropertyNames.add( referencedPropertyName.substring( 0, dotIndex ) );
|
||||
}
|
||||
// todo (PropertyMapping) : the problem here is timing. this needs to be delayed.
|
||||
final Type propertyType = ( (PropertyMapping) elementTypeDescriptor.getEntityPersister() )
|
||||
.toType( referencedPropertyName );
|
||||
final Type propertyType = elementTypeDescriptor.getEntityPersister().getPropertyType( referencedPropertyName );
|
||||
ToOneAttributeMapping.addPrefixedPropertyPaths(
|
||||
targetKeyPropertyNames,
|
||||
referencedPropertyName,
|
||||
|
|
|
@ -78,11 +78,8 @@ import org.hibernate.metamodel.mapping.SelectablePath;
|
|||
import org.hibernate.metamodel.mapping.VirtualModelPart;
|
||||
import org.hibernate.metamodel.model.domain.NavigableRole;
|
||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||
import org.hibernate.persister.collection.AbstractCollectionPersister;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.collection.QueryableCollection;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.property.access.internal.ChainedPropertyAccessImpl;
|
||||
import org.hibernate.property.access.spi.PropertyAccess;
|
||||
import org.hibernate.query.sqm.sql.SqmToSqlAstConverter;
|
||||
|
@ -498,7 +495,7 @@ public class MappingModelCreationHelper {
|
|||
final CollectionPersister collectionDescriptor = domainModel.findCollectionDescriptor( bootValueMapping.getRole() );
|
||||
assert collectionDescriptor != null;
|
||||
|
||||
final String tableExpression = ( (Joinable) collectionDescriptor ).getTableName();
|
||||
final String tableExpression = collectionDescriptor.getTableName();
|
||||
|
||||
final String sqlAliasStem = SqlAliasStemHelper.INSTANCE.generateStemFromAttributeName( bootProperty.getName() );
|
||||
|
||||
|
@ -564,15 +561,14 @@ public class MappingModelCreationHelper {
|
|||
|
||||
indexDescriptor = null;
|
||||
|
||||
final QueryableCollection loadableCollection = (QueryableCollection) collectionDescriptor;
|
||||
final String identifierColumnName = loadableCollection.getIdentifierColumnName();
|
||||
final String identifierColumnName = collectionDescriptor.getIdentifierColumnName();
|
||||
assert identifierColumnName != null;
|
||||
|
||||
identifierDescriptor = new CollectionIdentifierDescriptorImpl(
|
||||
collectionDescriptor,
|
||||
tableExpression,
|
||||
identifierColumnName,
|
||||
(BasicType) loadableCollection.getIdentifierType()
|
||||
(BasicType) collectionDescriptor.getIdentifierType()
|
||||
);
|
||||
|
||||
break;
|
||||
|
@ -765,10 +761,10 @@ public class MappingModelCreationHelper {
|
|||
final String lhsPropertyName = collectionDescriptor.getCollectionType().getLHSPropertyName();
|
||||
final boolean isReferenceToPrimaryKey = lhsPropertyName == null;
|
||||
final ManagedMappingType keyDeclaringType;
|
||||
final String collectionTableName = ((AbstractCollectionPersister) collectionDescriptor).getTableName();
|
||||
final String collectionTableName = collectionDescriptor.getTableName();
|
||||
|
||||
if ( collectionDescriptor.getElementType().isEntityType() ) {
|
||||
keyDeclaringType = ( (QueryableCollection) collectionDescriptor ).getElementPersister();
|
||||
keyDeclaringType = collectionDescriptor.getElementPersister();
|
||||
}
|
||||
else {
|
||||
// This is not "really correct" but it is as good as it gets.
|
||||
|
|
|
@ -45,7 +45,6 @@ import org.hibernate.metamodel.mapping.ordering.TranslationContext;
|
|||
import org.hibernate.metamodel.model.domain.NavigableRole;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.collection.mutation.CollectionMutationTarget;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.property.access.spi.PropertyAccess;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.sql.ast.SqlAstJoinType;
|
||||
|
@ -170,7 +169,7 @@ public class PluralAttributeMappingImpl
|
|||
separateCollectionTable = null;
|
||||
}
|
||||
else {
|
||||
separateCollectionTable = ( (Joinable) collectionDescriptor ).getTableName();
|
||||
separateCollectionTable = collectionDescriptor.getTableName();
|
||||
}
|
||||
|
||||
final int baseIndex;
|
||||
|
@ -955,7 +954,7 @@ public class PluralAttributeMappingImpl
|
|||
this,
|
||||
creationState.getSqlAliasBaseGenerator()
|
||||
);
|
||||
final String collectionTableName = ( (Joinable) collectionDescriptor ).getTableName();
|
||||
final String collectionTableName = collectionDescriptor.getTableName();
|
||||
final TableReference collectionTableReference = new NamedTableReference(
|
||||
collectionTableName,
|
||||
sqlAliasBase.generateNewAlias(),
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.hibernate.metamodel.model.domain.ManagedDomainType;
|
|||
import org.hibernate.metamodel.model.domain.PersistentAttribute;
|
||||
import org.hibernate.metamodel.model.domain.spi.JpaMetamodelImplementor;
|
||||
import org.hibernate.persister.entity.DiscriminatorMetadata;
|
||||
import org.hibernate.persister.entity.Queryable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.query.PathException;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
|
@ -71,19 +71,14 @@ public class EntityTypeImpl<J>
|
|||
this.jpaEntityName = jpaEntityName;
|
||||
this.metamodel = metamodel;
|
||||
|
||||
final Queryable entityDescriptor = (Queryable)
|
||||
final EntityPersister entityDescriptor =
|
||||
metamodel.getMappingMetamodel()
|
||||
.getEntityDescriptor( getHibernateEntityName() );
|
||||
final DiscriminatorMetadata discriminatorMetadata = entityDescriptor.getTypeDiscriminatorMetadata();
|
||||
final DomainType discriminatorType;
|
||||
if ( discriminatorMetadata != null ) {
|
||||
discriminatorType = (DomainType) discriminatorMetadata.getResolutionType();
|
||||
}
|
||||
else {
|
||||
discriminatorType = metamodel.getTypeConfiguration()
|
||||
.getBasicTypeRegistry()
|
||||
.resolve( StandardBasicTypes.STRING );
|
||||
}
|
||||
final DomainType discriminatorType =
|
||||
discriminatorMetadata != null
|
||||
? (DomainType) discriminatorMetadata.getResolutionType()
|
||||
: metamodel.getTypeConfiguration().getBasicTypeRegistry().resolve( StandardBasicTypes.STRING );
|
||||
|
||||
this.discriminatorPathSource = discriminatorType == null ? null : new EntityDiscriminatorSqmPathSource(
|
||||
discriminatorType,
|
||||
|
|
|
@ -59,7 +59,6 @@ import org.hibernate.metamodel.spi.MetamodelImplementor;
|
|||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Queryable;
|
||||
import org.hibernate.persister.spi.PersisterFactory;
|
||||
import org.hibernate.query.BindableType;
|
||||
import org.hibernate.query.derived.AnonymousTupleSqmPathSource;
|
||||
|
@ -316,9 +315,9 @@ public class MappingMetamodelImpl extends QueryParameterBindingTypeResolverImpl
|
|||
modelCreationContext
|
||||
);
|
||||
collectionPersisterMap.put( model.getRole(), persister );
|
||||
Type indexType = persister.getIndexType();
|
||||
final Type indexType = persister.getIndexType();
|
||||
if ( indexType != null && indexType.isEntityType() && !indexType.isAnyType() ) {
|
||||
String entityName = ( (org.hibernate.type.EntityType) indexType ).getAssociatedEntityName();
|
||||
final String entityName = ( (org.hibernate.type.EntityType) indexType ).getAssociatedEntityName();
|
||||
Set<String> roles = collectionRolesByEntityParticipant.get( entityName );
|
||||
//noinspection Java8MapApi
|
||||
if ( roles == null ) {
|
||||
|
@ -327,9 +326,9 @@ public class MappingMetamodelImpl extends QueryParameterBindingTypeResolverImpl
|
|||
}
|
||||
roles.add( persister.getRole() );
|
||||
}
|
||||
Type elementType = persister.getElementType();
|
||||
final Type elementType = persister.getElementType();
|
||||
if ( elementType.isEntityType() && !elementType.isAnyType() ) {
|
||||
String entityName = ( (org.hibernate.type.EntityType) elementType ).getAssociatedEntityName();
|
||||
final String entityName = ( (org.hibernate.type.EntityType) elementType ).getAssociatedEntityName();
|
||||
Set<String> roles = collectionRolesByEntityParticipant.get( entityName );
|
||||
//noinspection Java8MapApi
|
||||
if ( roles == null ) {
|
||||
|
@ -755,9 +754,8 @@ public class MappingMetamodelImpl extends QueryParameterBindingTypeResolverImpl
|
|||
}
|
||||
|
||||
private String[] doGetImplementors(Class<?> clazz) throws MappingException {
|
||||
ArrayList<String> results = new ArrayList<>();
|
||||
final ArrayList<String> results = new ArrayList<>();
|
||||
for ( EntityPersister checkPersister : entityPersisters().values() ) {
|
||||
if ( checkPersister instanceof Queryable ) {
|
||||
final String checkQueryableEntityName = ((EntityMappingType) checkPersister).getEntityName();
|
||||
final boolean isMappedClass = clazz.getName().equals( checkQueryableEntityName );
|
||||
if ( checkPersister.isExplicitPolymorphism() ) {
|
||||
|
@ -775,7 +773,7 @@ public class MappingMetamodelImpl extends QueryParameterBindingTypeResolverImpl
|
|||
final boolean assignableSuperclass;
|
||||
if ( checkPersister.isInherited() ) {
|
||||
final String superTypeName = checkPersister.getSuperMappingType().getEntityName();
|
||||
Class<?> mappedSuperclass = getEntityDescriptor( superTypeName ).getMappedClass();
|
||||
final Class<?> mappedSuperclass = getEntityDescriptor( superTypeName ).getMappedClass();
|
||||
assignableSuperclass = clazz.isAssignableFrom( mappedSuperclass );
|
||||
}
|
||||
else {
|
||||
|
@ -788,7 +786,6 @@ public class MappingMetamodelImpl extends QueryParameterBindingTypeResolverImpl
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return results.toArray( EMPTY_STRING_ARRAY );
|
||||
}
|
||||
|
|
|
@ -19,13 +19,11 @@ import java.util.Set;
|
|||
import java.util.function.Consumer;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.Filter;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Internal;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.TransientObjectException;
|
||||
import org.hibernate.annotations.CacheLayout;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
|
@ -96,7 +94,6 @@ import org.hibernate.persister.collection.mutation.RowMutationOperations;
|
|||
import org.hibernate.persister.entity.AbstractEntityPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.persister.entity.PropertyMapping;
|
||||
import org.hibernate.persister.internal.SqlFragmentPredicate;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.query.named.NamedQueryMemento;
|
||||
|
@ -159,7 +156,7 @@ import static org.hibernate.sql.model.ModelMutationLogging.MODEL_MUTATION_LOGGER
|
|||
*/
|
||||
@Internal
|
||||
public abstract class AbstractCollectionPersister
|
||||
implements CollectionPersister, CollectionMutationTarget, PluralAttributeMappingImpl.Aware, FetchProfileAffectee, DeprecatedCollectionStuff {
|
||||
implements CollectionPersister, CollectionMutationTarget, PluralAttributeMappingImpl.Aware, FetchProfileAffectee, Joinable {
|
||||
|
||||
private final NavigableRole navigableRole;
|
||||
private final CollectionSemantics<?,?> collectionSemantics;
|
||||
|
@ -213,7 +210,6 @@ public abstract class AbstractCollectionPersister
|
|||
private final boolean isMutable;
|
||||
private final boolean isVersioned;
|
||||
protected final int batchSize;
|
||||
private final FetchMode fetchMode;
|
||||
private final boolean hasOrphanDelete;
|
||||
private final boolean subselectLoadable;
|
||||
|
||||
|
@ -225,7 +221,6 @@ public abstract class AbstractCollectionPersister
|
|||
private final Dialect dialect;
|
||||
protected final SqlExceptionHelper sqlExceptionHelper;
|
||||
private final BeforeExecutionGenerator identifierGenerator;
|
||||
private final PropertyMapping elementPropertyMapping;
|
||||
private final EntityPersister elementPersister;
|
||||
private final @Nullable CollectionDataAccess cacheAccessStrategy;
|
||||
|
||||
|
@ -246,7 +241,6 @@ public abstract class AbstractCollectionPersister
|
|||
private final Comparator<?> comparator;
|
||||
|
||||
private CollectionLoader collectionLoader;
|
||||
// private volatile CollectionLoader standardCollectionLoader;
|
||||
private CollectionElementLoaderByIndex collectionElementLoaderByIndex;
|
||||
|
||||
private PluralAttributeMapping attributeMapping;
|
||||
|
@ -288,7 +282,6 @@ public abstract class AbstractCollectionPersister
|
|||
final Value elementBootDescriptor = collectionBootDescriptor.getElement();
|
||||
final Table table = collectionBootDescriptor.getCollectionTable();
|
||||
|
||||
fetchMode = elementBootDescriptor.getFetchMode();
|
||||
elementType = elementBootDescriptor.getType();
|
||||
// isSet = collectionBinding.isSet();
|
||||
// isSorted = collectionBinding.isSorted();
|
||||
|
@ -543,29 +536,6 @@ public abstract class AbstractCollectionPersister
|
|||
elementClass = null; // elementType.returnedClass();
|
||||
}
|
||||
|
||||
if ( elementType.isComponentType() ) {
|
||||
elementPropertyMapping = new CompositeElementPropertyMapping(
|
||||
elementColumnNames,
|
||||
elementColumnReaders,
|
||||
elementColumnReaderTemplates,
|
||||
elementFormulaTemplates,
|
||||
(CompositeType) elementType,
|
||||
creationContext.getMetadata()
|
||||
);
|
||||
}
|
||||
else if ( !elementType.isEntityType() ) {
|
||||
elementPropertyMapping = new ElementPropertyMapping( elementColumnNames, elementType );
|
||||
}
|
||||
else {
|
||||
// not all entity-persisters implement PropertyMapping!
|
||||
if ( elementPersister instanceof PropertyMapping ) {
|
||||
elementPropertyMapping = (PropertyMapping) elementPersister;
|
||||
}
|
||||
else {
|
||||
elementPropertyMapping = new ElementPropertyMapping( elementColumnNames, elementType );
|
||||
}
|
||||
}
|
||||
|
||||
hasOrder = collectionBootDescriptor.getOrderBy() != null;
|
||||
hasManyToManyOrder = collectionBootDescriptor.getManyToManyOrdering() != null;
|
||||
|
||||
|
@ -690,7 +660,7 @@ public abstract class AbstractCollectionPersister
|
|||
.resolve( factory, bootModel, queryLoaderName );
|
||||
if ( memento == null ) {
|
||||
throw new IllegalArgumentException( "Could not resolve named query '" + queryLoaderName
|
||||
+ "' for loading collection '" + getName() + "'" );
|
||||
+ "' for loading collection '" + getRole() + "'" );
|
||||
}
|
||||
return memento;
|
||||
}
|
||||
|
@ -860,11 +830,6 @@ public abstract class AbstractCollectionPersister
|
|||
protected abstract RowMutationOperations getRowMutationOperations();
|
||||
protected abstract RemoveCoordinator getRemoveCoordinator();
|
||||
|
||||
@Override
|
||||
public FetchMode getFetchMode() {
|
||||
return fetchMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOrdering() {
|
||||
return hasOrder;
|
||||
|
@ -875,11 +840,6 @@ public abstract class AbstractCollectionPersister
|
|||
return isManyToMany() && hasManyToManyOrder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasWhere() {
|
||||
return hasWhere;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the element class of an array, or null otherwise. needed by arrays
|
||||
*/
|
||||
|
@ -1053,46 +1013,14 @@ public abstract class AbstractCollectionPersister
|
|||
.toStatementString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIndexColumnNames() {
|
||||
return indexColumnNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIndexFormulas() {
|
||||
return indexFormulas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIndexColumnNames(String alias) {
|
||||
return qualify( alias, indexColumnNames, indexFormulaTemplates );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getElementColumnNames(String alias) {
|
||||
return qualify( alias, elementColumnNames, elementFormulaTemplates );
|
||||
}
|
||||
|
||||
private static String[] qualify(String alias, String[] columnNames, String[] formulaTemplates) {
|
||||
int span = columnNames.length;
|
||||
String[] result = new String[span];
|
||||
for ( int i = 0; i < span; i++ ) {
|
||||
if ( columnNames[i] == null ) {
|
||||
result[i] = StringHelper.replace( formulaTemplates[i], Template.TEMPLATE, alias );
|
||||
}
|
||||
else {
|
||||
result[i] = StringHelper.qualify( alias, columnNames[i] );
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getElementColumnNames() {
|
||||
return elementColumnNames; // TODO: something with formulas...
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getKeyColumnNames() {
|
||||
return keyColumnNames;
|
||||
}
|
||||
|
@ -1116,7 +1044,6 @@ public abstract class AbstractCollectionPersister
|
|||
return cascadeDeleteEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return qualifiedTableName;
|
||||
}
|
||||
|
@ -1163,15 +1090,6 @@ public abstract class AbstractCollectionPersister
|
|||
return hasOrphanDelete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type toType(String propertyName) throws QueryException {
|
||||
// todo (PropertyMapping) : simple delegation (aka, easy to remove)
|
||||
if ( "index".equals( propertyName ) ) {
|
||||
return indexType;
|
||||
}
|
||||
return elementPropertyMapping.toType( propertyName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyBaseRestrictions(
|
||||
Consumer<Predicate> predicateConsumer,
|
||||
|
@ -1206,7 +1124,7 @@ public abstract class AbstractCollectionPersister
|
|||
|
||||
@Override
|
||||
public boolean hasWhereRestrictions() {
|
||||
return hasWhere() || manyToManyWhereTemplate != null;
|
||||
return hasWhere || manyToManyWhereTemplate != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1215,12 +1133,12 @@ public abstract class AbstractCollectionPersister
|
|||
TableGroup tableGroup,
|
||||
boolean useQualifier,
|
||||
SqlAstCreationState creationState) {
|
||||
TableReference tableReference;
|
||||
final TableReference tableReference;
|
||||
if ( isManyToMany() ) {
|
||||
tableReference = tableGroup.getPrimaryTableReference();
|
||||
}
|
||||
else if ( elementPersister instanceof Joinable ) {
|
||||
tableReference = tableGroup.getTableReference( tableGroup.getNavigablePath(), ( (Joinable) elementPersister ).getTableName() );
|
||||
else if ( elementPersister != null ) {
|
||||
tableReference = tableGroup.getTableReference( tableGroup.getNavigablePath(), elementPersister.getTableName() );
|
||||
}
|
||||
else {
|
||||
tableReference = tableGroup.getTableReference( tableGroup.getNavigablePath(), qualifiedTableName );
|
||||
|
@ -1313,7 +1231,7 @@ public abstract class AbstractCollectionPersister
|
|||
}
|
||||
|
||||
if ( manyToManyWhereString != null ) {
|
||||
final TableReference tableReference = tableGroup.resolveTableReference( ( (Joinable) elementPersister ).getTableName() );
|
||||
final TableReference tableReference = tableGroup.resolveTableReference( elementPersister.getTableName() );
|
||||
|
||||
final String alias;
|
||||
if ( tableReference == null ) {
|
||||
|
@ -1339,43 +1257,17 @@ public abstract class AbstractCollectionPersister
|
|||
}
|
||||
|
||||
if ( manyToManyWhereString != null ) {
|
||||
if ( fragment.length() > 0 ) {
|
||||
if ( !fragment.isEmpty() ) {
|
||||
fragment.append( " and " );
|
||||
}
|
||||
assert elementPersister instanceof Joinable;
|
||||
final TableReference tableReference = tableGroup.resolveTableReference( ( (Joinable) elementPersister ).getTableName() );
|
||||
assert elementPersister != null;
|
||||
final TableReference tableReference = tableGroup.resolveTableReference( elementPersister.getTableName() );
|
||||
fragment.append( StringHelper.replace( manyToManyWhereTemplate, Template.TEMPLATE, tableReference.getIdentificationVariable() ) );
|
||||
}
|
||||
|
||||
return fragment.toString();
|
||||
}
|
||||
|
||||
private String[] indexFragments;
|
||||
|
||||
@Override
|
||||
public String[] toColumns(String propertyName) throws QueryException {
|
||||
// todo (PropertyMapping) : simple delegation (aka, easy to remove)
|
||||
if ( "index".equals( propertyName ) ) {
|
||||
if ( indexFragments == null ) {
|
||||
String[] tmp = new String[indexColumnNames.length];
|
||||
for ( int i = 0; i < indexColumnNames.length; i++ ) {
|
||||
tmp[i] = indexColumnNames[i] == null
|
||||
? indexFormulas[i]
|
||||
: indexColumnNames[i];
|
||||
indexFragments = tmp;
|
||||
}
|
||||
}
|
||||
return indexFragments;
|
||||
}
|
||||
|
||||
return elementPropertyMapping.toColumns( propertyName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getRole();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPersister getElementPersister() {
|
||||
if ( elementPersister == null ) {
|
||||
|
@ -1388,11 +1280,6 @@ public abstract class AbstractCollectionPersister
|
|||
return elementPersister;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollection() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getCollectionSpaces() {
|
||||
return spaces;
|
||||
|
@ -1870,8 +1757,6 @@ public abstract class AbstractCollectionPersister
|
|||
final ForeignKeyDescriptor fkDescriptor = getAttributeMapping().getKeyDescriptor();
|
||||
assert fkDescriptor != null;
|
||||
|
||||
final int keyColumnCount = fkDescriptor.getJdbcTypeCount();
|
||||
|
||||
fkDescriptor.getKeyPart().forEachSelectable( parameterList );
|
||||
for ( ColumnValueParameter columnValueParameter : parameterList ) {
|
||||
final ColumnReference columnReference = columnValueParameter.getColumnReference();
|
||||
|
|
|
@ -457,4 +457,23 @@ public interface CollectionPersister extends Restrictable {
|
|||
*/
|
||||
@Deprecated( forRemoval = true )
|
||||
Type getIdentifierType();
|
||||
|
||||
String getIdentifierColumnName();
|
||||
|
||||
String getTableName();
|
||||
|
||||
/**
|
||||
* Generate a list of collection index and element columns
|
||||
*/
|
||||
String selectFragment(String alias, String columnSuffix);
|
||||
|
||||
String[] getCollectionPropertyColumnAliases(String propertyName, String string);
|
||||
|
||||
/**
|
||||
* Get the persister of the element class, if this is a
|
||||
* collection of entities (optional operation). Note that
|
||||
* for a one-to-many association, the returned persister
|
||||
* must be {@code OuterJoinLoadable}.
|
||||
*/
|
||||
EntityPersister getElementPersister();
|
||||
}
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.persister.collection;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.Remove;
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.persister.entity.AbstractPropertyMapping;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* @author Gavin King
|
||||
*
|
||||
* @deprecated Replaced by {@link org.hibernate.metamodel.mapping.internal.EmbeddedCollectionPart}
|
||||
*/
|
||||
@Deprecated(since = "6", forRemoval = true)
|
||||
@Remove
|
||||
public class CompositeElementPropertyMapping extends AbstractPropertyMapping {
|
||||
|
||||
private final CompositeType compositeType;
|
||||
|
||||
public CompositeElementPropertyMapping(
|
||||
String[] elementColumns,
|
||||
String[] elementColumnReaders,
|
||||
String[] elementColumnReaderTemplates,
|
||||
String[] elementFormulaTemplates,
|
||||
CompositeType compositeType,
|
||||
Metadata factory)
|
||||
throws MappingException {
|
||||
|
||||
this.compositeType = compositeType;
|
||||
|
||||
initComponentPropertyPaths(null, compositeType, elementColumns, elementColumnReaders,
|
||||
elementColumnReaderTemplates, elementFormulaTemplates, factory );
|
||||
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return compositeType;
|
||||
}
|
||||
|
||||
protected String getEntityName() {
|
||||
return compositeType.getName();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
|
||||
*/
|
||||
package org.hibernate.persister.collection;
|
||||
|
||||
/**
|
||||
* @deprecated Just used to singly extend all the deprecated collection persister roles
|
||||
*/
|
||||
@Deprecated
|
||||
public interface DeprecatedCollectionStuff extends QueryableCollection {
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.persister.collection;
|
||||
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.Remove;
|
||||
import org.hibernate.persister.entity.PropertyMapping;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* @author Gavin King
|
||||
*
|
||||
* @deprecated Replaced by {@link org.hibernate.metamodel.mapping.CollectionPart}
|
||||
*/
|
||||
@Deprecated(since = "6", forRemoval = true)
|
||||
@Remove
|
||||
public class ElementPropertyMapping implements PropertyMapping {
|
||||
|
||||
private final String[] elementColumns;
|
||||
private final Type type;
|
||||
|
||||
public ElementPropertyMapping(String[] elementColumns, Type type) {
|
||||
this.elementColumns = elementColumns;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Type toType(String propertyName) throws QueryException {
|
||||
if ( propertyName==null || "id".equals(propertyName) ) {
|
||||
return type;
|
||||
}
|
||||
else {
|
||||
throw new QueryException("Cannot dereference scalar collection element: " + propertyName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a property path, return the corresponding column name(s).
|
||||
*/
|
||||
public String[] toColumns(String propertyName) {
|
||||
throw new UnsupportedOperationException( "References to collections must define an SQL alias" );
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
}
|
|
@ -55,7 +55,6 @@ import org.hibernate.persister.collection.mutation.UpdateRowsCoordinator;
|
|||
import org.hibernate.persister.collection.mutation.UpdateRowsCoordinatorNoOp;
|
||||
import org.hibernate.persister.collection.mutation.UpdateRowsCoordinatorOneToMany;
|
||||
import org.hibernate.persister.collection.mutation.UpdateRowsCoordinatorTablePerSubclass;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.persister.entity.UnionSubclassEntityPersister;
|
||||
import org.hibernate.sql.ast.SqlAstTranslator;
|
||||
import org.hibernate.sql.ast.spi.SqlAstCreationState;
|
||||
|
@ -257,7 +256,7 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return ( (Joinable) getElementPersister() ).getTableName();
|
||||
return getElementPersister().getTableName();
|
||||
}
|
||||
|
||||
protected void applyWhereFragments(
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.persister.collection;
|
||||
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.persister.entity.PropertyMapping;
|
||||
|
||||
/**
|
||||
* A collection role that may be queried or loaded by outer join.
|
||||
*
|
||||
* @author Gavin King
|
||||
*
|
||||
* @deprecated Given the mapping-model and SQM, this contract is no longer needed.
|
||||
* Note however that {@link org.hibernate.query.sql.internal.SQLQueryParser} currently
|
||||
* uses this along with other
|
||||
*/
|
||||
@Deprecated( since = "6", forRemoval = true )
|
||||
public interface QueryableCollection extends PropertyMapping, Joinable, CollectionPersister {
|
||||
/**
|
||||
* Generate a list of collection index and element columns
|
||||
*/
|
||||
String selectFragment(String alias, String columnSuffix);
|
||||
/**
|
||||
* Get the names of the collection index columns if
|
||||
* this is an indexed collection (optional operation)
|
||||
*/
|
||||
String[] getIndexColumnNames();
|
||||
/**
|
||||
* Get the index formulas if this is an indexed collection
|
||||
* (optional operation)
|
||||
*/
|
||||
String[] getIndexFormulas();
|
||||
/**
|
||||
* Get the names of the collection index columns if
|
||||
* this is an indexed collection (optional operation),
|
||||
* aliased by the given table alias
|
||||
*/
|
||||
String[] getIndexColumnNames(String alias);
|
||||
/**
|
||||
* Get the names of the collection element columns (or the primary
|
||||
* key columns in the case of a one-to-many association),
|
||||
* aliased by the given table alias
|
||||
*/
|
||||
String[] getElementColumnNames(String alias);
|
||||
/**
|
||||
* Get the names of the collection element columns (or the primary
|
||||
* key columns in the case of a one-to-many association)
|
||||
*/
|
||||
String[] getElementColumnNames();
|
||||
|
||||
String getIdentifierColumnName();
|
||||
|
||||
String[] getCollectionPropertyColumnAliases(String propertyName, String string);
|
||||
|
||||
/**
|
||||
* Does this collection role have a where clause filter?
|
||||
*/
|
||||
boolean hasWhere();
|
||||
/**
|
||||
* Get the persister of the element class, if this is a
|
||||
* collection of entities (optional operation). Note that
|
||||
* for a one-to-many association, the returned persister
|
||||
* must be {@code OuterJoinLoadable}.
|
||||
*/
|
||||
EntityPersister getElementPersister();
|
||||
/**
|
||||
* Should we load this collection role by outerjoining?
|
||||
*/
|
||||
FetchMode getFetchMode();
|
||||
}
|
|
@ -330,12 +330,13 @@ import static org.hibernate.sql.ast.spi.SqlExpressionResolver.createColumnRefere
|
|||
@Internal
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class AbstractEntityPersister
|
||||
implements InFlightEntityMappingType, EntityMutationTarget, LazyPropertyInitializer, FetchProfileAffectee, DeprecatedEntityStuff {
|
||||
implements EntityPersister, InFlightEntityMappingType, EntityMutationTarget, LazyPropertyInitializer, FetchProfileAffectee, Joinable {
|
||||
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( AbstractEntityPersister.class );
|
||||
|
||||
public static final String ENTITY_CLASS = "class";
|
||||
public static final String VERSION_COLUMN_ALIAS = "version_";
|
||||
public static final String ROWID_ALIAS = "rowid_";
|
||||
|
||||
private final NavigableRole navigableRole;
|
||||
private final SessionFactoryImplementor factory;
|
||||
|
@ -379,7 +380,6 @@ public abstract class AbstractEntityPersister
|
|||
private final String[] lazyPropertyNames;
|
||||
private final int[] lazyPropertyNumbers;
|
||||
private final Type[] lazyPropertyTypes;
|
||||
private final String[][] lazyPropertyColumnAliases;
|
||||
|
||||
//information about all properties in class hierarchy
|
||||
private final String[] subclassPropertyNameClosure;
|
||||
|
@ -466,7 +466,7 @@ public abstract class AbstractEntityPersister
|
|||
* for the concrete EntityPersister (since the concrete EntityPersister
|
||||
* cannot have duplicated property names).
|
||||
*/
|
||||
protected final BasicEntityPropertyMapping propertyMapping;
|
||||
private final EntityPropertyMapping propertyMapping;
|
||||
|
||||
private final boolean implementsLifecycle;
|
||||
|
||||
|
@ -540,7 +540,7 @@ public abstract class AbstractEntityPersister
|
|||
hasPartitionedSelectionMapping = persistentClass.hasPartitionedSelectionMapping();
|
||||
hasCollectionNotReferencingPK = persistentClass.hasCollectionNotReferencingPK();
|
||||
|
||||
propertyMapping = new BasicEntityPropertyMapping( this );
|
||||
propertyMapping = new EntityPropertyMapping( this );
|
||||
|
||||
// IDENTIFIER
|
||||
|
||||
|
@ -614,7 +614,6 @@ public abstract class AbstractEntityPersister
|
|||
final ArrayList<String> lazyNames = new ArrayList<>();
|
||||
final ArrayList<Integer> lazyNumbers = new ArrayList<>();
|
||||
final ArrayList<Type> lazyTypes = new ArrayList<>();
|
||||
final ArrayList<String[]> lazyColAliases = new ArrayList<>();
|
||||
|
||||
final List<Property> propertyClosure = persistentClass.getPropertyClosure();
|
||||
boolean foundFormula = false;
|
||||
|
@ -666,14 +665,12 @@ public abstract class AbstractEntityPersister
|
|||
lazyNames.add( prop.getName() );
|
||||
lazyNumbers.add( i );
|
||||
lazyTypes.add( prop.getValue().getType() );
|
||||
lazyColAliases.add( colAliases );
|
||||
}
|
||||
|
||||
propertyColumnUpdateable[i] = prop.getValue().getColumnUpdateability();
|
||||
propertyColumnInsertable[i] = prop.getValue().getColumnInsertability();
|
||||
}
|
||||
hasFormulaProperties = foundFormula;
|
||||
lazyPropertyColumnAliases = to2DStringArray( lazyColAliases );
|
||||
lazyPropertyNames = toStringArray( lazyNames );
|
||||
lazyPropertyNumbers = toIntArray( lazyNumbers );
|
||||
lazyPropertyTypes = toTypeArray( lazyTypes );
|
||||
|
@ -945,7 +942,6 @@ public abstract class AbstractEntityPersister
|
|||
return queryCacheLayout == CacheLayout.SHALLOW_WITH_DISCRIMINATOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract String getSubclassTableName(int j);
|
||||
|
||||
protected abstract String[] getSubclassTableNames();
|
||||
|
@ -2142,11 +2138,6 @@ public abstract class AbstractEntityPersister
|
|||
return getSubclassTableName( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRootTableAlias(String drivingAlias) {
|
||||
return drivingAlias;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getRootTableIdentifierColumnNames() {
|
||||
return getRootTableKeyColumnNames();
|
||||
|
@ -2167,22 +2158,6 @@ public abstract class AbstractEntityPersister
|
|||
return propertyMapping.getColumnNames( propertyName );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Warning:
|
||||
* When there are duplicated property names in the subclasses
|
||||
* then this method may return the wrong results.
|
||||
* To ensure correct results, this method should only be used when
|
||||
* {@literal this} is the concrete EntityPersister (since the
|
||||
* concrete EntityPersister cannot have duplicated property names).
|
||||
*/
|
||||
@Override
|
||||
public Type toType(String propertyName) throws QueryException {
|
||||
// todo (PropertyMapping) : simple delegation (aka, easy to remove)
|
||||
return propertyMapping.toType( propertyName );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
|
@ -2206,7 +2181,6 @@ public abstract class AbstractEntityPersister
|
|||
* SingleTableEntityPersister defines an overloaded form
|
||||
* which takes the entity name.
|
||||
*/
|
||||
@Override
|
||||
public int getSubclassPropertyTableNumber(String propertyPath) {
|
||||
throw new UnsupportedOperationException();
|
||||
// String rootPropertyName = StringHelper.root( propertyPath );
|
||||
|
@ -2234,23 +2208,8 @@ public abstract class AbstractEntityPersister
|
|||
// return index == -1 ? 0 : getSubclassPropertyTableNumber( index );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Declarer getSubclassPropertyDeclarer(String propertyPath) {
|
||||
int tableIndex = getSubclassPropertyTableNumber( propertyPath );
|
||||
if ( tableIndex == 0 ) {
|
||||
return Declarer.CLASS;
|
||||
}
|
||||
else if ( isClassOrSuperclassTable( tableIndex ) ) {
|
||||
return Declarer.SUPERCLASS;
|
||||
}
|
||||
else {
|
||||
return Declarer.SUBCLASS;
|
||||
}
|
||||
}
|
||||
|
||||
private DiscriminatorType<?> discriminatorType;
|
||||
|
||||
|
||||
protected DiscriminatorType<?> resolveDiscriminatorType() {
|
||||
if ( discriminatorType == null ) {
|
||||
discriminatorType = buildDiscriminatorType();
|
||||
|
@ -2308,7 +2267,6 @@ public abstract class AbstractEntityPersister
|
|||
return ArrayHelper.indexOf( subclassPropertyNameClosure, propertyName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertyColumnNames(int i) {
|
||||
return propertyColumnNames[i];
|
||||
}
|
||||
|
@ -2335,7 +2293,6 @@ public abstract class AbstractEntityPersister
|
|||
return subclassPropertyColumnNameClosure[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[][] getSubclassPropertyFormulaTemplateClosure() {
|
||||
return subclassPropertyFormulaTemplateClosure;
|
||||
}
|
||||
|
@ -2801,14 +2758,6 @@ public abstract class AbstractEntityPersister
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an object
|
||||
*/
|
||||
@Override
|
||||
public void delete(Object id, Object version, Object object, SharedSessionContractImplementor session) {
|
||||
deleteCoordinator.delete( object, id, version, session );
|
||||
}
|
||||
|
||||
protected void logStaticSQL() {
|
||||
if ( LOG.isDebugEnabled() ) {
|
||||
LOG.debugf( "Static SQL for entity: %s", getEntityName() );
|
||||
|
@ -2859,6 +2808,8 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
public abstract Map<Object, String> getSubclassByDiscriminatorValue();
|
||||
|
||||
public abstract String[] getConstraintOrderedTableNameClosure();
|
||||
|
||||
public abstract boolean needsDiscriminator();
|
||||
|
||||
protected boolean isDiscriminatorFormula() {
|
||||
|
@ -3212,11 +3163,6 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateFilterConditionAlias(String rootAlias) {
|
||||
return rootAlias;
|
||||
}
|
||||
|
||||
protected boolean shouldInnerJoinSubclassTable(int subclassTableNumber, Set<String> treatAsDeclarations) {
|
||||
if ( isClassOrSuperclassJoin( subclassTableNumber ) ) {
|
||||
// the table is either this persister's driving table or (one of) its superclass persister's driving
|
||||
|
@ -3310,6 +3256,8 @@ public abstract class AbstractEntityPersister
|
|||
return GeneratedValuesHelper.getGeneratedValuesDelegate( this, UPDATE );
|
||||
}
|
||||
|
||||
public abstract String[][] getContraintOrderedTableKeyColumnClosure();
|
||||
|
||||
private static class TableMappingBuilder {
|
||||
private final String tableName;
|
||||
private final int relativePosition;
|
||||
|
@ -4099,21 +4047,10 @@ public abstract class AbstractEntityPersister
|
|||
return concreteTypeLoader.getConcreteType( id, session );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getKeyColumnNames() {
|
||||
return getIdentifierColumnNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getEntityName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollection() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
|
@ -4173,11 +4110,6 @@ public abstract class AbstractEntityPersister
|
|||
&& ( isVersionGeneratedOnExecution() || isVersionGeneratedBeforeExecution() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVersionPropertyInsertable() {
|
||||
return isVersioned() && getPropertyInsertability()[getVersionProperty()];
|
||||
}
|
||||
|
||||
public boolean isVersionGeneratedOnExecution() {
|
||||
final Generator strategy = getEntityMetamodel().getGenerators()[ getVersionProperty() ];
|
||||
return strategy != null && strategy.generatesSometimes() && strategy.generatedOnExecution();
|
||||
|
@ -4486,12 +4418,7 @@ public abstract class AbstractEntityPersister
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override @Deprecated(since = "6.0")
|
||||
public boolean isMultiTable() {
|
||||
return hasMultipleTables();
|
||||
}
|
||||
|
||||
protected boolean hasMultipleTables() {
|
||||
public boolean hasMultipleTables() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4711,11 +4638,6 @@ public abstract class AbstractEntityPersister
|
|||
return entityMetamodel.getBytecodeEnhancementMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableAliasForColumn(String columnName, String rootAlias) {
|
||||
return generateTableAlias( rootAlias, determineTableNumberForColumn( columnName ) );
|
||||
}
|
||||
|
||||
public int determineTableNumberForColumn(String columnName) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -6289,20 +6211,6 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by Hibernate Reactive
|
||||
*
|
||||
* @deprecated Hibernate no longer uses aliases to read from result sets
|
||||
*/
|
||||
@Deprecated @SuppressWarnings("unused")
|
||||
protected String[][] getLazyPropertyColumnAliases() {
|
||||
return lazyPropertyColumnAliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Hibernate no longer uses aliases to read from result sets
|
||||
*/
|
||||
@Deprecated
|
||||
public String getDiscriminatorAlias() {
|
||||
return DISCRIMINATOR_ALIAS;
|
||||
}
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.persister.entity;
|
||||
|
||||
import org.hibernate.Remove;
|
||||
|
||||
/**
|
||||
* @author Gavin King
|
||||
*
|
||||
* @deprecated Replaced by {@link org.hibernate.metamodel.mapping.EntityMappingType}
|
||||
*/
|
||||
@Deprecated(since = "6", forRemoval = true)
|
||||
@Remove
|
||||
public class BasicEntityPropertyMapping extends AbstractPropertyMapping {
|
||||
|
||||
private final AbstractEntityPersister persister;
|
||||
|
||||
public BasicEntityPropertyMapping(AbstractEntityPersister persister) {
|
||||
this.persister = persister;
|
||||
}
|
||||
|
||||
public String[] getIdentifierColumnNames() {
|
||||
return persister.getIdentifierColumnNames();
|
||||
}
|
||||
|
||||
public String[] getIdentifierColumnReaders() {
|
||||
return persister.getIdentifierColumnReaders();
|
||||
}
|
||||
|
||||
public String[] getIdentifierColumnReaderTemplates() {
|
||||
return persister.getIdentifierColumnReaderTemplates();
|
||||
}
|
||||
|
||||
protected String getEntityName() {
|
||||
return persister.getEntityName();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
|
||||
*/
|
||||
package org.hibernate.persister.entity;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated Just used to singly extend all the deprecated entity persister roles
|
||||
*/
|
||||
@Deprecated
|
||||
public interface DeprecatedEntityStuff extends Loadable, Lockable, Queryable {
|
||||
}
|
|
@ -44,12 +44,12 @@ import org.hibernate.type.descriptor.jdbc.JdbcType;
|
|||
@Deprecated( since = "6.2", forRemoval = true )
|
||||
public class DiscriminatorType<T> extends AbstractType implements BasicType<T> {
|
||||
private final BasicType<Object> underlyingType;
|
||||
private final Loadable persister;
|
||||
private final EntityPersister persister;
|
||||
private final DiscriminatorConverter converter;
|
||||
|
||||
public DiscriminatorType(
|
||||
BasicType<?> underlyingType,
|
||||
Loadable persister,
|
||||
EntityPersister persister,
|
||||
DiscriminatorConverter converter) {
|
||||
this.underlyingType = (BasicType<Object>) underlyingType;
|
||||
this.persister = persister;
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.LockMode;
|
||||
|
@ -42,6 +43,7 @@ import org.hibernate.loader.ast.spi.MultiIdLoadOptions;
|
|||
import org.hibernate.loader.ast.spi.MultiNaturalIdLoader;
|
||||
import org.hibernate.loader.ast.spi.NaturalIdLoader;
|
||||
import org.hibernate.metamodel.mapping.AttributeMapping;
|
||||
import org.hibernate.metamodel.mapping.EntityDiscriminatorMapping;
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
import org.hibernate.metamodel.mapping.ModelPart;
|
||||
import org.hibernate.metamodel.mapping.internal.InFlightEntityMappingType;
|
||||
|
@ -1216,9 +1218,14 @@ public interface EntityPersister extends EntityMappingType, EntityMutationTarget
|
|||
FilterAliasGenerator getFilterAliasGenerator(final String rootAlias);
|
||||
|
||||
default FilterAliasGenerator getFilterAliasGenerator(TableGroup rootTableGroup) {
|
||||
return new TableGroupFilterAliasGenerator( ( (Joinable) this ).getTableName(), rootTableGroup );
|
||||
return new TableGroupFilterAliasGenerator( getTableName(), rootTableGroup );
|
||||
}
|
||||
|
||||
/**
|
||||
* The table to join to.
|
||||
*/
|
||||
String getTableName();
|
||||
|
||||
/**
|
||||
* Converts an array of attribute names to a set of indexes, according to the entity metamodel
|
||||
*
|
||||
|
@ -1311,5 +1318,101 @@ public interface EntityPersister extends EntityMappingType, EntityMutationTarget
|
|||
*/
|
||||
String getIdentitySelectString();
|
||||
|
||||
/**
|
||||
* Get the names of columns used to persist the identifier
|
||||
*/
|
||||
String[] getIdentifierColumnNames();
|
||||
|
||||
/**
|
||||
* Get the result set aliases used for the identifier columns, given a suffix
|
||||
*/
|
||||
String[] getIdentifierAliases(String suffix);
|
||||
|
||||
/**
|
||||
* Locks are always applied to the "root table".
|
||||
*
|
||||
* @return The root table name
|
||||
*/
|
||||
String getRootTableName();
|
||||
|
||||
/**
|
||||
* Get the names of columns on the root table used to persist the identifier.
|
||||
*
|
||||
* @return The root table identifier column names.
|
||||
*/
|
||||
String[] getRootTableIdentifierColumnNames();
|
||||
|
||||
/**
|
||||
* For versioned entities, get the name of the column (again, expected on the
|
||||
* root table) used to store the version values.
|
||||
*
|
||||
* @return The version column name.
|
||||
*/
|
||||
String getVersionColumnName();
|
||||
|
||||
/**
|
||||
* Get the result set aliases used for the property columns, given a suffix (properties of this class, only).
|
||||
*/
|
||||
String[] getPropertyAliases(String suffix, int i);
|
||||
|
||||
/**
|
||||
* Get the result set aliases used for the identifier columns, given a suffix
|
||||
*/
|
||||
String getDiscriminatorAlias(String suffix);
|
||||
|
||||
/**
|
||||
* @return the column name for the discriminator as specified in the mapping.
|
||||
*
|
||||
* @deprecated Use {@link EntityDiscriminatorMapping#getSelectionExpression()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
String getDiscriminatorColumnName();
|
||||
|
||||
/**
|
||||
* Get the discriminator type
|
||||
*/
|
||||
Type getDiscriminatorType();
|
||||
|
||||
/**
|
||||
* Does the result set contain rowids?
|
||||
*/
|
||||
boolean hasRowId();
|
||||
|
||||
/**
|
||||
* Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).
|
||||
*/
|
||||
String[] getSubclassPropertyColumnAliases(String propertyName, String suffix);
|
||||
|
||||
/**
|
||||
* May this (subclass closure) property be fetched using an SQL outer join?
|
||||
*/
|
||||
FetchMode getFetchMode(int i);
|
||||
|
||||
/**
|
||||
* Get the type of the numbered property of the class or a subclass.
|
||||
*/
|
||||
Type getSubclassPropertyType(int i);
|
||||
|
||||
/**
|
||||
* Get the column names for the given property path
|
||||
*/
|
||||
String[] getPropertyColumnNames(String propertyPath);
|
||||
|
||||
/**
|
||||
* All columns to select, when loading.
|
||||
*/
|
||||
String selectFragment(String alias, String suffix);
|
||||
|
||||
/**
|
||||
* Retrieve the information needed to properly deal with this entity's discriminator
|
||||
* in a query.
|
||||
*
|
||||
* @return The entity discriminator metadata
|
||||
*/
|
||||
DiscriminatorMetadata getTypeDiscriminatorMetadata();
|
||||
|
||||
/**
|
||||
* Given a property path, return the corresponding column name(s).
|
||||
*/
|
||||
String[] toColumns(String propertyName);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.hibernate.internal.util.StringHelper;
|
|||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.mapping.Collection;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.sql.Template;
|
||||
import org.hibernate.type.AnyType;
|
||||
import org.hibernate.type.AssociationType;
|
||||
import org.hibernate.type.CollectionType;
|
||||
|
@ -35,41 +34,46 @@ import org.hibernate.type.SpecialOneToOneType;
|
|||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* Basic implementation of the {@link PropertyMapping} contract.
|
||||
*
|
||||
* @author Gavin King
|
||||
*
|
||||
* @deprecated Replaced by {@link org.hibernate.metamodel.mapping.EntityMappingType}
|
||||
*/
|
||||
@Deprecated(since = "6", forRemoval = true)
|
||||
@Remove
|
||||
public abstract class AbstractPropertyMapping implements PropertyMapping {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( AbstractPropertyMapping.class );
|
||||
class EntityPropertyMapping {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( EntityPropertyMapping.class );
|
||||
|
||||
private final Map<String, Type> typesByPropertyPath = new HashMap<>();
|
||||
private final AbstractEntityPersister persister;
|
||||
|
||||
public EntityPropertyMapping(AbstractEntityPersister persister) {
|
||||
this.persister = persister;
|
||||
}
|
||||
|
||||
public String[] getIdentifierColumnNames() {
|
||||
return persister.getIdentifierColumnNames();
|
||||
}
|
||||
|
||||
public String[] getIdentifierColumnReaders() {
|
||||
return persister.getIdentifierColumnReaders();
|
||||
}
|
||||
|
||||
public String[] getIdentifierColumnReaderTemplates() {
|
||||
return persister.getIdentifierColumnReaderTemplates();
|
||||
}
|
||||
|
||||
protected String getEntityName() {
|
||||
return persister.getEntityName();
|
||||
}
|
||||
|
||||
//This field is only used during initialization, no need for threadsafety:
|
||||
//FIXME get rid of the field, or at least clear it after boot? Not urgent as we typically won't initialize it at all.
|
||||
//FIXME get rid of the field, or at least clear it after boot?
|
||||
// Not urgent as we typically won't initialize it at all.
|
||||
private Set<String> duplicateIncompatiblePaths = null;
|
||||
|
||||
private final Map<String, String[]> columnsByPropertyPath = new HashMap<>();
|
||||
private final Map<String, String[]> columnReadersByPropertyPath = new HashMap<>();
|
||||
private final Map<String, String[]> columnReaderTemplatesByPropertyPath = new HashMap<>();
|
||||
private final Map<String, String[]> formulaTemplatesByPropertyPath = new HashMap<>();
|
||||
|
||||
public String[] getIdentifierColumnNames() {
|
||||
throw new UnsupportedOperationException( "one-to-one is not supported here" );
|
||||
}
|
||||
|
||||
public String[] getIdentifierColumnReaderTemplates() {
|
||||
throw new UnsupportedOperationException( "one-to-one is not supported here" );
|
||||
}
|
||||
|
||||
public String[] getIdentifierColumnReaders() {
|
||||
throw new UnsupportedOperationException( "one-to-one is not supported here" );
|
||||
}
|
||||
|
||||
protected abstract String getEntityName();
|
||||
|
||||
public Type toType(String propertyName) throws QueryException {
|
||||
Type type = typesByPropertyPath.get( propertyName );
|
||||
|
@ -91,25 +95,6 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
return cols;
|
||||
}
|
||||
|
||||
public String[] toColumns(String propertyName) throws QueryException {
|
||||
String[] columns = columnsByPropertyPath.get( propertyName );
|
||||
if ( columns == null ) {
|
||||
throw propertyException( propertyName );
|
||||
}
|
||||
String[] formulaTemplates = formulaTemplatesByPropertyPath.get( propertyName );
|
||||
String[] columnReaders = columnReadersByPropertyPath.get( propertyName );
|
||||
String[] result = new String[columns.length];
|
||||
for ( int i = 0; i < columns.length; i++ ) {
|
||||
if ( columnReaders[i] == null ) {
|
||||
result[i] = StringHelper.replace( formulaTemplates[i], Template.TEMPLATE, "" );
|
||||
}
|
||||
else {
|
||||
result[i] = columnReaders[i];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void logDuplicateRegistration(String path, Type existingType, Type type) {
|
||||
if ( LOG.isTraceEnabled() ) {
|
||||
LOG.tracev(
|
||||
|
@ -139,7 +124,6 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
String[] columns,
|
||||
String[] columnReaders,
|
||||
String[] columnReaderTemplates,
|
||||
String[] formulaTemplates,
|
||||
Metadata factory) {
|
||||
Type existingType = typesByPropertyPath.get( path );
|
||||
if ( existingType != null || ( duplicateIncompatiblePaths != null && duplicateIncompatiblePaths.contains( path ) ) ) {
|
||||
|
@ -197,9 +181,6 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
columnsByPropertyPath.put( path, empty );
|
||||
columnReadersByPropertyPath.put( path, empty );
|
||||
columnReaderTemplatesByPropertyPath.put( path, empty );
|
||||
if ( formulaTemplates != null ) {
|
||||
formulaTemplatesByPropertyPath.put( path, empty );
|
||||
}
|
||||
}
|
||||
else {
|
||||
typesByPropertyPath.put( path, commonType );
|
||||
|
@ -212,9 +193,6 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
columnsByPropertyPath.put( path, columns );
|
||||
columnReadersByPropertyPath.put( path, columnReaders );
|
||||
columnReaderTemplatesByPropertyPath.put( path, columnReaderTemplates );
|
||||
if ( formulaTemplates != null ) {
|
||||
formulaTemplatesByPropertyPath.put( path, formulaTemplates );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,17 +231,6 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
return clazz2;
|
||||
}
|
||||
|
||||
/*protected void initPropertyPaths(
|
||||
final String path,
|
||||
final Type type,
|
||||
final String[] columns,
|
||||
final String[] formulaTemplates,
|
||||
final Mapping factory)
|
||||
throws MappingException {
|
||||
//addFormulaPropertyPath(path, type, formulaTemplates);
|
||||
initPropertyPaths(path, type, columns, formulaTemplates, factory);
|
||||
}*/
|
||||
|
||||
protected void initPropertyPaths(
|
||||
final String path,
|
||||
final Type type,
|
||||
|
@ -305,7 +272,7 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
}
|
||||
|
||||
if ( path != null ) {
|
||||
addPropertyPath( path, type, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
|
||||
addPropertyPath( path, type, columns, columnReaders, columnReaderTemplates, factory );
|
||||
}
|
||||
|
||||
if ( type.isComponentType() ) {
|
||||
|
@ -344,16 +311,6 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
}
|
||||
}
|
||||
|
||||
protected void initIdentifierPropertyPaths(
|
||||
final String path,
|
||||
final EntityType etype,
|
||||
final String[] columns,
|
||||
final String[] columnReaders,
|
||||
final String[] columnReaderTemplates,
|
||||
final Metadata factory) throws MappingException {
|
||||
initIdentifierPropertyPaths(path, etype, columns, columnReaders, columnReaderTemplates, null, factory);
|
||||
}
|
||||
|
||||
protected void initIdentifierPropertyPaths(
|
||||
final String path,
|
||||
final EntityType etype,
|
||||
|
@ -370,14 +327,14 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
if ( etype.isReferenceToPrimaryKey() ) {
|
||||
if ( !hasNonIdentifierPropertyNamedId ) {
|
||||
String idpath1 = extendPath( path, EntityPersister.ENTITY_ID );
|
||||
addPropertyPath( idpath1, idtype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
|
||||
addPropertyPath( idpath1, idtype, columns, columnReaders, columnReaderTemplates, factory );
|
||||
initPropertyPaths( idpath1, idtype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !etype.isNullable() && idPropName != null ) {
|
||||
String idpath2 = extendPath( path, idPropName );
|
||||
addPropertyPath( idpath2, idtype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
|
||||
addPropertyPath( idpath2, idtype, columns, columnReaders, columnReaderTemplates, factory );
|
||||
initPropertyPaths( idpath2, idtype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
|
||||
}
|
||||
}
|
|
@ -6,8 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.persister.entity;
|
||||
|
||||
import org.hibernate.metamodel.mapping.Restrictable;
|
||||
|
||||
/**
|
||||
* Anything that can be loaded by outer join - namely
|
||||
* persisters for classes or collections.
|
||||
|
@ -20,25 +18,5 @@ import org.hibernate.metamodel.mapping.Restrictable;
|
|||
* depending on need
|
||||
*/
|
||||
@Deprecated(since = "6", forRemoval = true)
|
||||
public interface Joinable extends Restrictable {
|
||||
//should this interface extend PropertyMapping?
|
||||
|
||||
/**
|
||||
* An identifying name; a class name or collection role name.
|
||||
*/
|
||||
String getName();
|
||||
/**
|
||||
* The table to join to.
|
||||
*/
|
||||
String getTableName();
|
||||
|
||||
/**
|
||||
* The columns to join on
|
||||
*/
|
||||
String[] getKeyColumnNames();
|
||||
|
||||
/**
|
||||
* Is this instance actually a CollectionPersister?
|
||||
*/
|
||||
boolean isCollection();
|
||||
public interface Joinable {
|
||||
}
|
||||
|
|
|
@ -757,17 +757,6 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
return discriminatorAlias;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubclassForDiscriminatorValue(Object value) {
|
||||
if ( value == null ) {
|
||||
return subclassesByDiscriminatorValue.get( NULL_DISCRIMINATOR );
|
||||
}
|
||||
else {
|
||||
final String result = subclassesByDiscriminatorValue.get( value );
|
||||
return result == null ? subclassesByDiscriminatorValue.get( NOT_NULL_DISCRIMINATOR ) : result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDiscriminatorToInsertGroup(MutationGroupBuilder insertGroupBuilder) {
|
||||
if ( explicitDiscriminatorColumnName != null ) {
|
||||
|
@ -865,11 +854,6 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
return tableNames[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateFilterConditionAlias(String rootAlias) {
|
||||
return generateTableAlias( rootAlias, tableSpan - 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIdentifierColumnNames() {
|
||||
return tableKeyColumns[0];
|
||||
|
@ -896,7 +880,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasMultipleTables() {
|
||||
public boolean hasMultipleTables() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -980,20 +964,6 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
return constraintOrderedKeyColumnNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRootTableAlias(String drivingAlias) {
|
||||
return generateTableAlias( drivingAlias, getTableId( getRootTableName(), tableNames ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Declarer getSubclassPropertyDeclarer(String propertyPath) {
|
||||
if ( "class".equals( propertyPath ) ) {
|
||||
// special case where we need to force include all subclass joins
|
||||
return Declarer.SUBCLASS;
|
||||
}
|
||||
return super.getSubclassPropertyDeclarer( propertyPath );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int determineTableNumberForColumn(String columnName) {
|
||||
// HHH-7630: In case the naturalOrder/identifier column is explicitly given in the ordering, check here.
|
||||
|
|
|
@ -1,134 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.persister.entity;
|
||||
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.metamodel.mapping.EntityDiscriminatorMapping;
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* Implemented by any {@link EntityPersister} that may be loaded
|
||||
* using a {@link org.hibernate.loader.ast.spi.Loader}.
|
||||
*
|
||||
* @author Gavin King
|
||||
*
|
||||
* @deprecated Use {@link EntityMappingType}
|
||||
*/
|
||||
@Deprecated(since = "6", forRemoval = true)
|
||||
public interface Loadable extends EntityPersister {
|
||||
|
||||
String ROWID_ALIAS = "rowid_";
|
||||
|
||||
/**
|
||||
* Does this persistent class have subclasses?
|
||||
*
|
||||
* @deprecated See {@link EntityMappingType#hasSubclasses()}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean hasSubclasses();
|
||||
|
||||
/**
|
||||
* Get the discriminator type
|
||||
*/
|
||||
Type getDiscriminatorType();
|
||||
|
||||
/**
|
||||
* Get the discriminator value
|
||||
*
|
||||
* @deprecated Use {@link EntityMappingType#getDiscriminatorValue()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
Object getDiscriminatorValue();
|
||||
|
||||
/**
|
||||
* Get the concrete subclass corresponding to the given discriminator
|
||||
* value
|
||||
*
|
||||
* @deprecated Use {@link EntityDiscriminatorMapping#resolveDiscriminatorValue} instead
|
||||
*/
|
||||
@Deprecated
|
||||
String getSubclassForDiscriminatorValue(Object value);
|
||||
|
||||
/**
|
||||
* Get the names of columns used to persist the identifier
|
||||
*/
|
||||
String[] getIdentifierColumnNames();
|
||||
|
||||
/**
|
||||
* Get the result set aliases used for the identifier columns, given a suffix
|
||||
*/
|
||||
String[] getIdentifierAliases(String suffix);
|
||||
/**
|
||||
* Get the result set aliases used for the property columns, given a suffix (properties of this class, only).
|
||||
*/
|
||||
String[] getPropertyAliases(String suffix, int i);
|
||||
|
||||
/**
|
||||
* Get the result set column names mapped for this property (properties of this class, only).
|
||||
*/
|
||||
String[] getPropertyColumnNames(int i);
|
||||
|
||||
/**
|
||||
* Get the result set aliases used for the identifier columns, given a suffix
|
||||
*/
|
||||
String getDiscriminatorAlias(String suffix);
|
||||
|
||||
/**
|
||||
* @return the column name for the discriminator as specified in the mapping.
|
||||
*
|
||||
* @deprecated Use {@link EntityDiscriminatorMapping#getSelectionExpression()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
String getDiscriminatorColumnName();
|
||||
|
||||
/**
|
||||
* Does the result set contain rowids?
|
||||
*/
|
||||
boolean hasRowId();
|
||||
|
||||
boolean isAbstract();
|
||||
|
||||
/**
|
||||
* Given a column name and the root table alias in use for the entity hierarchy, determine the proper table alias
|
||||
* for the table in that hierarchy that contains said column.
|
||||
*
|
||||
* @implNote Generally speaking the column is not validated to exist. Most implementations simply return the
|
||||
* root alias; the exception is {@link JoinedSubclassEntityPersister}.
|
||||
*
|
||||
* @param columnName The column name
|
||||
* @param rootAlias The hierarchy root alias
|
||||
*
|
||||
* @return The proper table alias for qualifying the given column.
|
||||
*/
|
||||
String getTableAliasForColumn(String columnName, String rootAlias);
|
||||
|
||||
/**
|
||||
* All columns to select, when loading.
|
||||
*/
|
||||
String selectFragment(String alias, String suffix);
|
||||
|
||||
/**
|
||||
* Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).
|
||||
*/
|
||||
String[] getSubclassPropertyColumnAliases(String propertyName, String suffix);
|
||||
|
||||
/**
|
||||
* May this (subclass closure) property be fetched using an SQL outerjoin?
|
||||
*/
|
||||
FetchMode getFetchMode(int i);
|
||||
|
||||
/**
|
||||
* Get the type of the numbered property of the class or a subclass.
|
||||
*/
|
||||
Type getSubclassPropertyType(int i);
|
||||
|
||||
/**
|
||||
* Get the column names for the given property path
|
||||
*/
|
||||
String[] getPropertyColumnNames(String propertyPath);
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.persister.entity;
|
||||
|
||||
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
|
||||
/**
|
||||
* Contract for things that can be locked via a {@link org.hibernate.dialect.lock.LockingStrategy}.
|
||||
* <p>
|
||||
* Currently only the root table gets locked, except for the case of HQL and Criteria queries
|
||||
* against dialects which do not support either (1) FOR UPDATE OF or (2) support hint locking
|
||||
* (in which case *all* queried tables would be locked).
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
* @since 3.2
|
||||
*
|
||||
* @deprecated Use {@link EntityMappingType}
|
||||
*/
|
||||
@Deprecated(since = "6", forRemoval = true)
|
||||
public interface Lockable extends EntityPersister {
|
||||
/**
|
||||
* Locks are always applied to the "root table".
|
||||
*
|
||||
* @return The root table name
|
||||
*/
|
||||
String getRootTableName();
|
||||
|
||||
/**
|
||||
* Get the SQL alias this persister would use for the root table
|
||||
* given the passed driving alias.
|
||||
*
|
||||
* @param drivingAlias The driving alias; or the alias for the table
|
||||
* mapped by this persister in the hierarchy.
|
||||
* @return The root table alias.
|
||||
*/
|
||||
String getRootTableAlias(String drivingAlias);
|
||||
|
||||
/**
|
||||
* Get the names of columns on the root table used to persist the identifier.
|
||||
*
|
||||
* @return The root table identifier column names.
|
||||
*/
|
||||
String[] getRootTableIdentifierColumnNames();
|
||||
|
||||
/**
|
||||
* For versioned entities, get the name of the column (again, expected on the
|
||||
* root table) used to store the version values.
|
||||
*
|
||||
* @return The version column name.
|
||||
*/
|
||||
String getVersionColumnName();
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.persister.entity;
|
||||
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.Remove;
|
||||
import org.hibernate.persister.collection.CompositeElementPropertyMapping;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* Contract for all things that know how to map a property to the needed bits of SQL.
|
||||
* <p>
|
||||
* The column/formula fragments that represent a property in the table defining the property be obtained by
|
||||
* calling {@link #toColumns(String)}.
|
||||
*
|
||||
* <p>
|
||||
* Note, the methods here are generally ascribed to accept "property paths". That is a historical necessity because
|
||||
* of how Hibernate originally understood composites (embeddables) internally. That is in the process of changing
|
||||
* as Hibernate has added {@link CompositeElementPropertyMapping}
|
||||
*
|
||||
* @author Gavin King
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
* @deprecated This interface is obsolete
|
||||
*/
|
||||
@Deprecated(since = "6", forRemoval = true)
|
||||
@Remove
|
||||
public interface PropertyMapping {
|
||||
|
||||
// /**
|
||||
// * @asciidoc
|
||||
// *
|
||||
// * Resolve a sub-reference relative to this PropertyMapping. E.g.,
|
||||
// * given the PropertyMapping for an entity named `Person` with an embedded
|
||||
// * property `#name` calling this method with `"name"` returns the
|
||||
// * PropertyMapping for the `Name` embeddable
|
||||
// * <p>
|
||||
// * todo (6.0) : define an exception in the signature for cases where the PropertyMapping
|
||||
// * cannot be de-referenced (basic values)
|
||||
// */
|
||||
// PropertyMapping resolveSubMapping(String name);
|
||||
|
||||
// todo (6.0) : add capability to create SqmPath, i.e.
|
||||
// SqmPath createSqmPath(SqmPath<?> lhs, SqmCreationState creationState);
|
||||
|
||||
// todo (6.0) : add capability to resolve SQL tree Expression
|
||||
// actually define this in ter
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// todo (6.0) remove
|
||||
|
||||
/**
|
||||
* Given a component path expression, get the type of the property
|
||||
*/
|
||||
Type toType(String propertyName) throws QueryException;
|
||||
|
||||
/**
|
||||
* Given a property path, return the corresponding column name(s).
|
||||
*/
|
||||
String[] toColumns(String propertyName) throws QueryException, UnsupportedOperationException;
|
||||
}
|
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.persister.entity;
|
||||
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
|
||||
/**
|
||||
* Extends the generic {@link EntityPersister} contract to add
|
||||
* operations required by the Hibernate Query Language
|
||||
*
|
||||
* @author Gavin King
|
||||
*
|
||||
* @deprecated Use {@link org.hibernate.metamodel.mapping.EntityMappingType}
|
||||
* instead
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
public interface Queryable extends Loadable, PropertyMapping, Joinable {
|
||||
|
||||
/**
|
||||
* Is this an abstract class?
|
||||
*
|
||||
* @see EntityMappingType#isAbstract()
|
||||
*/
|
||||
boolean isAbstract();
|
||||
/**
|
||||
* Is this class explicit polymorphism only?
|
||||
*
|
||||
* @see EntityMappingType#isExplicitPolymorphism()
|
||||
*/
|
||||
boolean isExplicitPolymorphism();
|
||||
|
||||
/**
|
||||
* Get the class that this class is mapped as a subclass of -
|
||||
* not necessarily the direct superclass
|
||||
*
|
||||
* @see EntityMappingType#getSuperMappingType()
|
||||
*/
|
||||
String getMappedSuperclass();
|
||||
|
||||
/**
|
||||
* Get the discriminator value for this particular concrete subclass,
|
||||
* as a string that may be embedded in a select statement
|
||||
*
|
||||
* @see EntityMappingType#getDiscriminatorSQLValue()
|
||||
*/
|
||||
String getDiscriminatorSQLValue();
|
||||
|
||||
/**
|
||||
* Get the names of columns used to persist the identifier
|
||||
*/
|
||||
String[] getIdentifierColumnNames();
|
||||
|
||||
/**
|
||||
* Is the inheritance hierarchy described by this persister contained across
|
||||
* multiple tables?
|
||||
*
|
||||
* @return True if the inheritance hierarchy is spread across multiple tables; false otherwise.
|
||||
*
|
||||
* @deprecated Use {@link EntityPersister#getSqmMultiTableMutationStrategy} instead
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
default boolean isMultiTable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the names of all tables used in the hierarchy (up and down) ordered such
|
||||
* that deletes in the given order would not cause constraint violations.
|
||||
*
|
||||
* @return The ordered array of table names.
|
||||
*/
|
||||
String[] getConstraintOrderedTableNameClosure();
|
||||
|
||||
/**
|
||||
* For each table specified in {@link #getConstraintOrderedTableNameClosure()}, get
|
||||
* the columns that define the key between the various hierarchy classes.
|
||||
* <p>
|
||||
* The first dimension here corresponds to the table indexes returned in
|
||||
* {@link #getConstraintOrderedTableNameClosure()}.
|
||||
* <p>
|
||||
* The second dimension should have the same length across all the elements in
|
||||
* the first dimension. If not, that would be a problem ;)
|
||||
*
|
||||
*/
|
||||
String[][] getContraintOrderedTableKeyColumnClosure();
|
||||
|
||||
/**
|
||||
* Given a property name, determine the number of the table which contains the column
|
||||
* to which this property is mapped.
|
||||
* <p>
|
||||
* Note that this is <b>not</b> relative to the results from {@link #getConstraintOrderedTableNameClosure()}.
|
||||
* It is relative to the subclass table name closure maintained internal to the persister (yick!).
|
||||
* It is also relative to the indexing used to resolve {@link #getSubclassTableName}...
|
||||
*
|
||||
* @param propertyPath The name of the property.
|
||||
* @return The number of the table to which the property is mapped.
|
||||
*/
|
||||
int getSubclassPropertyTableNumber(String propertyPath);
|
||||
|
||||
/**
|
||||
* Determine whether the given property is declared by our
|
||||
* mapped class, our super class, or one of our subclasses...
|
||||
* <p>
|
||||
* Note: the method is called 'subclass property...' simply
|
||||
* for consistency sake (e.g. {@link #getSubclassPropertyTableNumber}
|
||||
*
|
||||
* @param propertyPath The property name.
|
||||
* @return The property declarer
|
||||
*/
|
||||
Declarer getSubclassPropertyDeclarer(String propertyPath);
|
||||
|
||||
/**
|
||||
* Get the name of the table with the given index from the internal
|
||||
* array.
|
||||
*
|
||||
* @param number The index into the internal array.
|
||||
*/
|
||||
String getSubclassTableName(int number);
|
||||
|
||||
/**
|
||||
* Is the version property included in insert statements?
|
||||
*/
|
||||
boolean isVersionPropertyInsertable();
|
||||
|
||||
/**
|
||||
* The alias used for any filter conditions (mapped where-fragments or
|
||||
* enabled-filters).
|
||||
* <p>
|
||||
* This may or may not be different from the root alias depending upon the
|
||||
* inheritance mapping strategy.
|
||||
*
|
||||
* @param rootAlias The root alias
|
||||
* @return The alias used for "filter conditions" within the where clause.
|
||||
*/
|
||||
String generateFilterConditionAlias(String rootAlias);
|
||||
|
||||
/**
|
||||
* Retrieve the information needed to properly deal with this entity's discriminator
|
||||
* in a query.
|
||||
*
|
||||
* @return The entity discriminator metadata
|
||||
*/
|
||||
DiscriminatorMetadata getTypeDiscriminatorMetadata();
|
||||
|
||||
String[][] getSubclassPropertyFormulaTemplateClosure();
|
||||
|
||||
class Declarer {
|
||||
public static final Declarer CLASS = new Declarer( "class" );
|
||||
public static final Declarer SUBCLASS = new Declarer( "subclass" );
|
||||
public static final Declarer SUPERCLASS = new Declarer( "superclass" );
|
||||
private final String name;
|
||||
public Declarer(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -48,7 +48,6 @@ import static org.hibernate.internal.util.collections.ArrayHelper.toIntArray;
|
|||
import static org.hibernate.internal.util.collections.ArrayHelper.toStringArray;
|
||||
import static org.hibernate.internal.util.collections.CollectionHelper.toSmallMap;
|
||||
import static org.hibernate.jdbc.Expectations.createExpectation;
|
||||
import static org.hibernate.persister.entity.DiscriminatorHelper.NOT_NULL_DISCRIMINATOR;
|
||||
import static org.hibernate.persister.entity.DiscriminatorHelper.NULL_DISCRIMINATOR;
|
||||
import static org.hibernate.sql.model.ast.builder.TableMutationBuilder.NULL;
|
||||
|
||||
|
@ -425,17 +424,6 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
return subclassClosure;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubclassForDiscriminatorValue(Object value) {
|
||||
if ( value == null ) {
|
||||
return subclassesByDiscriminatorValue.get( NULL_DISCRIMINATOR );
|
||||
}
|
||||
else {
|
||||
final String result = subclassesByDiscriminatorValue.get( value );
|
||||
return result == null ? subclassesByDiscriminatorValue.get( NOT_NULL_DISCRIMINATOR ) : result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertySpaces() {
|
||||
return spaces;
|
||||
|
@ -561,7 +549,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasMultipleTables() {
|
||||
public boolean hasMultipleTables() {
|
||||
return getTableSpan() > 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -298,11 +298,6 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
return discriminatorSQLValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubclassForDiscriminatorValue(Object value) {
|
||||
return subclassByDiscriminatorValue.get( value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertySpaces() {
|
||||
return spaces;
|
||||
|
@ -362,7 +357,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasMultipleTables() {
|
||||
public boolean hasMultipleTables() {
|
||||
// This could also just be true all the time...
|
||||
return isAbstract() || hasSubclasses();
|
||||
}
|
||||
|
|
|
@ -248,19 +248,15 @@ public class ResultSetMappingImpl implements ResultSetMapping {
|
|||
if ( resultBuilders.size() == 1 && domainResults.size() == 1 && domainResults.get( 0 ) instanceof EntityResult ) {
|
||||
// Special case for result set mappings that just fetch a single polymorphic entity
|
||||
final EntityResult entityResult = (EntityResult) domainResults.get( 0 );
|
||||
final boolean polymorphic = entityResult.getReferencedMappingContainer()
|
||||
.getEntityPersister()
|
||||
.getEntityMetamodel()
|
||||
.isPolymorphic();
|
||||
final EntityPersister persister = entityResult.getReferencedMappingContainer().getEntityPersister();
|
||||
final boolean polymorphic = persister.getEntityMetamodel().isPolymorphic();
|
||||
// We only need to check for duplicate aliases if we have join fetches,
|
||||
// otherwise we assume that even if there are duplicate aliases, the values are equivalent.
|
||||
// If we don't do that, there is no way to fetch joined inheritance entities
|
||||
if ( polymorphic && ( legacyFetchBuilders == null || legacyFetchBuilders.isEmpty() )
|
||||
&& !entityResult.hasJoinFetches() ) {
|
||||
final Set<String> aliases = new TreeSet<>( String.CASE_INSENSITIVE_ORDER );
|
||||
final AbstractEntityPersister entityPersister = (AbstractEntityPersister)
|
||||
entityResult.getReferencedMappingContainer()
|
||||
.getEntityPersister();
|
||||
final AbstractEntityPersister entityPersister = (AbstractEntityPersister) persister;
|
||||
for ( String[] columns : entityPersister.getContraintOrderedTableKeyColumnClosure() ) {
|
||||
addColumns( aliases, knownDuplicateAliases, columns );
|
||||
}
|
||||
|
|
|
@ -26,9 +26,7 @@ import org.hibernate.loader.internal.AliasConstantsHelper;
|
|||
import org.hibernate.metamodel.mapping.CollectionPart;
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.collection.QueryableCollection;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Loadable;
|
||||
import org.hibernate.query.NativeQuery;
|
||||
import org.hibernate.query.results.FetchBuilder;
|
||||
import org.hibernate.query.results.ResultSetMapping;
|
||||
|
@ -234,7 +232,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
|||
null,
|
||||
determineNavigablePath( fetchBuilder )
|
||||
);
|
||||
final Loadable loadable = (Loadable) alias2Persister.get( fetchBuilder.getOwnerAlias() );
|
||||
final EntityPersister loadable = alias2Persister.get( fetchBuilder.getOwnerAlias() );
|
||||
final List<String> columnNames;
|
||||
final String[] columnAliases = loadable.getSubclassPropertyColumnAliases(
|
||||
fetchBuilder.getFetchableName(),
|
||||
|
@ -306,7 +304,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
|||
String suffix,
|
||||
LockMode lockMode,
|
||||
NavigablePath navigablePath) {
|
||||
final Loadable loadable = (Loadable) entityMapping.getEntityPersister();
|
||||
final EntityPersister loadable = entityMapping.getEntityPersister();
|
||||
final DynamicResultBuilderEntityStandard resultBuilderEntity = new DynamicResultBuilderEntityStandard(
|
||||
entityMapping,
|
||||
tableAlias,
|
||||
|
@ -345,7 +343,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
|||
|
||||
private void addFetchBuilder(
|
||||
String suffix,
|
||||
Loadable loadable,
|
||||
EntityPersister loadable,
|
||||
DynamicFetchBuilderContainer resultBuilderEntity,
|
||||
String tableAlias,
|
||||
String[] identifierAliases,
|
||||
|
@ -408,7 +406,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
|||
final CollectionPersister collectionPersister = collectionReturn.getPluralAttribute().getCollectionDescriptor();
|
||||
final String[] elementColumnAliases;
|
||||
if ( collectionPersister.getElementType().isEntityType() ) {
|
||||
final Loadable elementPersister = (Loadable) ( ( QueryableCollection ) collectionPersister).getElementPersister();
|
||||
final EntityPersister elementPersister = collectionPersister.getElementPersister();
|
||||
final String[] propertyNames = elementPersister.getPropertyNames();
|
||||
final String[] identifierAliases = elementPersister.getIdentifierAliases( entitySuffix );
|
||||
final String discriminatorAlias = elementPersister.getDiscriminatorAlias( entitySuffix );
|
||||
|
@ -439,14 +437,9 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
|||
);
|
||||
}
|
||||
|
||||
private Loadable getSQLLoadable(String entityName) throws MappingException {
|
||||
final EntityPersister entityDescriptor = factory.getRuntimeMetamodels()
|
||||
.getMappingMetamodel()
|
||||
private EntityPersister getSQLLoadable(String entityName) throws MappingException {
|
||||
return factory.getRuntimeMetamodels().getMappingMetamodel()
|
||||
.getEntityDescriptor( entityName );
|
||||
if ( !(entityDescriptor instanceof Loadable) ) {
|
||||
throw new MappingException( "class persister is not Loadable: " + entityName );
|
||||
}
|
||||
return (Loadable) entityDescriptor;
|
||||
}
|
||||
|
||||
private String generateEntitySuffix() {
|
||||
|
@ -499,12 +492,12 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
|||
return;
|
||||
}
|
||||
|
||||
Loadable persister = (Loadable) rootReturn.getEntityMapping().getEntityPersister();
|
||||
EntityPersister persister = rootReturn.getEntityMapping().getEntityPersister();
|
||||
Map<String, String[]> propertyResultsMap = Collections.emptyMap();//rootReturn.getPropertyResultsMap()
|
||||
addPersister( rootReturn.getTableAlias(), propertyResultsMap, persister );
|
||||
}
|
||||
|
||||
private void addPersister(String alias, Map<String, String[]> propertyResult, Loadable persister) {
|
||||
private void addPersister(String alias, Map<String, String[]> propertyResult, EntityPersister persister) {
|
||||
alias2Persister.put( alias, persister );
|
||||
String suffix = generateEntitySuffix();
|
||||
LOG.tracev( "Mapping alias [{0}] to entity-suffix [{1}]", alias, suffix );
|
||||
|
@ -514,7 +507,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
|||
|
||||
private void addCollection(String role, String alias, Map<String, String[]> propertyResults) {
|
||||
|
||||
final QueryableCollection collectionDescriptor = (QueryableCollection)
|
||||
final CollectionPersister collectionDescriptor =
|
||||
factory.getRuntimeMetamodels().getMappingMetamodel()
|
||||
.getCollectionDescriptor( role );
|
||||
|
||||
|
@ -525,8 +518,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
|||
collectionPropertyResultMaps.put( alias, propertyResults );
|
||||
|
||||
if ( collectionDescriptor.isOneToMany() || collectionDescriptor.isManyToMany() ) {
|
||||
Loadable persister = (Loadable) collectionDescriptor.getElementPersister();
|
||||
addPersister( alias, filter( propertyResults ), persister );
|
||||
addPersister( alias, filter( propertyResults ), collectionDescriptor.getElementPersister() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -563,7 +555,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
|||
processReturn( alias2Return.get( ownerAlias ) );
|
||||
}
|
||||
|
||||
Loadable ownerPersister = (Loadable) alias2Persister.get( ownerAlias );
|
||||
EntityPersister ownerPersister = alias2Persister.get( ownerAlias );
|
||||
Type returnType = ownerPersister.getPropertyType( fetchReturn.getFetchableName() );
|
||||
|
||||
if ( returnType.isCollectionType() ) {
|
||||
|
@ -575,7 +567,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
|||
else if ( returnType.isEntityType() ) {
|
||||
EntityType eType = ( EntityType ) returnType;
|
||||
String returnEntityName = eType.getAssociatedEntityName();
|
||||
Loadable persister = getSQLLoadable( returnEntityName );
|
||||
EntityPersister persister = getSQLLoadable( returnEntityName );
|
||||
Map<String, String[]> propertyResultsMap = Collections.emptyMap();//fetchReturn.getPropertyResultsMap()
|
||||
addPersister( alias, propertyResultsMap, persister );
|
||||
}
|
||||
|
@ -592,13 +584,13 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Loadable getEntityPersister(String alias) {
|
||||
return (Loadable) alias2Persister.get( alias );
|
||||
public EntityPersister getEntityPersister(String alias) {
|
||||
return alias2Persister.get( alias );
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableCollection getCollectionPersister(String alias) {
|
||||
return (QueryableCollection) alias2CollectionPersister.get( alias );
|
||||
public CollectionPersister getCollectionPersister(String alias) {
|
||||
return alias2CollectionPersister.get( alias );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,8 +13,8 @@ import org.hibernate.boot.model.naming.Identifier;
|
|||
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.persister.collection.QueryableCollection;
|
||||
import org.hibernate.persister.entity.Loadable;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
||||
/**
|
||||
* Substitutes escape sequences of form {@code {alias}},
|
||||
|
@ -36,10 +36,10 @@ public class SQLQueryParser {
|
|||
|
||||
public interface ParserContext {
|
||||
boolean isEntityAlias(String aliasName);
|
||||
Loadable getEntityPersister(String alias);
|
||||
EntityPersister getEntityPersister(String alias);
|
||||
String getEntitySuffix(String alias);
|
||||
boolean isCollectionAlias(String aliasName);
|
||||
QueryableCollection getCollectionPersister(String alias);
|
||||
CollectionPersister getCollectionPersister(String alias);
|
||||
String getCollectionSuffix(String alias);
|
||||
Map<String, String[]> getPropertyResultsMap(String alias);
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ public class SQLQueryParser {
|
|||
String aliasName,
|
||||
String propertyName) {
|
||||
final Map<String, String[]> fieldResults = context.getPropertyResultsMap( aliasName );
|
||||
final QueryableCollection collectionPersister = context.getCollectionPersister( aliasName );
|
||||
final CollectionPersister collectionPersister = context.getCollectionPersister( aliasName );
|
||||
final String collectionSuffix = context.getCollectionSuffix( aliasName );
|
||||
switch ( propertyName ) {
|
||||
case "*":
|
||||
|
@ -234,7 +234,7 @@ public class SQLQueryParser {
|
|||
|
||||
private String resolveProperties(String aliasName, String propertyName) {
|
||||
final Map<String, String[]> fieldResults = context.getPropertyResultsMap( aliasName );
|
||||
final Loadable persister = context.getEntityPersister( aliasName );
|
||||
final EntityPersister persister = context.getEntityPersister( aliasName );
|
||||
final String suffix = context.getEntitySuffix( aliasName );
|
||||
if ( "*".equals( propertyName ) ) {
|
||||
if ( !fieldResults.isEmpty() ) {
|
||||
|
|
|
@ -614,7 +614,7 @@ public class QuerySqmImpl<R>
|
|||
final AbstractEntityPersister persister = (AbstractEntityPersister)
|
||||
getSessionFactory().getMappingMetamodel().getEntityDescriptor( entityNameToInsert );
|
||||
|
||||
boolean useMultiTableInsert = persister.isMultiTable();
|
||||
boolean useMultiTableInsert = persister.hasMultipleTables();
|
||||
if ( !useMultiTableInsert && !isSimpleValuesInsert( sqmInsert, persister ) ) {
|
||||
final Generator identifierGenerator = persister.getGenerator();
|
||||
if ( identifierGenerator instanceof BulkInsertionCapableIdentifierGenerator
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
|||
import org.hibernate.metamodel.mapping.SqlExpressible;
|
||||
import org.hibernate.persister.entity.AbstractEntityPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.query.SemanticException;
|
||||
import org.hibernate.query.SortDirection;
|
||||
import org.hibernate.query.results.TableGroupImpl;
|
||||
|
@ -662,7 +661,7 @@ public class CteInsertHandler implements InsertHandler {
|
|||
.getMappingMetamodel()
|
||||
.getEntityDescriptor( rootEntityName );
|
||||
|
||||
final String hierarchyRootTableName = ( (Joinable) rootEntityDescriptor ).getTableName();
|
||||
final String hierarchyRootTableName = rootEntityDescriptor.getTableName();
|
||||
final TableReference hierarchyRootTableReference = updatingTableGroup.resolveTableReference(
|
||||
updatingTableGroup.getNavigablePath(),
|
||||
hierarchyRootTableName
|
||||
|
|
|
@ -19,7 +19,6 @@ import org.hibernate.internal.util.collections.CollectionHelper;
|
|||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
import org.hibernate.persister.entity.AbstractEntityPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.query.SemanticException;
|
||||
import org.hibernate.query.results.TableGroupImpl;
|
||||
import org.hibernate.query.sqm.ComparisonOperator;
|
||||
|
@ -87,7 +86,7 @@ public class CteUpdateHandler extends AbstractCteMutationHandler implements Upda
|
|||
.getMappingMetamodel()
|
||||
.getEntityDescriptor( rootEntityName );
|
||||
|
||||
final String hierarchyRootTableName = ( (Joinable) rootEntityDescriptor ).getTableName();
|
||||
final String hierarchyRootTableName = rootEntityDescriptor.getTableName();
|
||||
final TableReference hierarchyRootTableReference = updatingTableGroup.resolveTableReference(
|
||||
updatingTableGroup.getNavigablePath(),
|
||||
hierarchyRootTableName
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
|||
import org.hibernate.metamodel.mapping.SelectableConsumer;
|
||||
import org.hibernate.metamodel.mapping.internal.MappingModelCreationHelper;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||
import org.hibernate.query.spi.QueryOptions;
|
||||
import org.hibernate.query.spi.QueryParameterBindings;
|
||||
|
@ -93,7 +92,7 @@ public class RestrictedDeleteExecutionDelegate extends AbstractDeleteExecutionDe
|
|||
final EntityPersister entityDescriptor = getSessionFactory().getRuntimeMetamodels()
|
||||
.getMappingMetamodel()
|
||||
.getEntityDescriptor( getSqmDelete().getTarget().getEntityName() );
|
||||
final String hierarchyRootTableName = ( (Joinable) entityDescriptor ).getTableName();
|
||||
final String hierarchyRootTableName = entityDescriptor.getTableName();
|
||||
|
||||
final TableGroup deletingTableGroup = getConverter().getMutatingTableGroup();
|
||||
|
||||
|
@ -169,7 +168,7 @@ public class RestrictedDeleteExecutionDelegate extends AbstractDeleteExecutionDe
|
|||
assert getEntityDescriptor() == getEntityDescriptor().getRootEntityDescriptor();
|
||||
|
||||
final EntityPersister rootEntityPersister = getEntityDescriptor().getEntityPersister();
|
||||
final String rootTableName = ( (Joinable) rootEntityPersister ).getTableName();
|
||||
final String rootTableName = rootEntityPersister.getTableName();
|
||||
final NamedTableReference rootTableReference = (NamedTableReference) tableGroup.resolveTableReference(
|
||||
tableGroup.getNavigablePath(),
|
||||
rootTableName
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
package org.hibernate.query.sqm.mutation.internal.temptable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
|
@ -24,7 +21,6 @@ import org.hibernate.generator.Generator;
|
|||
import org.hibernate.id.OptimizableGenerator;
|
||||
import org.hibernate.id.enhanced.Optimizer;
|
||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||
import org.hibernate.query.sqm.internal.DomainParameterXref;
|
||||
|
@ -33,7 +29,6 @@ import org.hibernate.query.sqm.mutation.internal.InsertHandler;
|
|||
import org.hibernate.query.sqm.mutation.internal.MultiTableSqmMutationConverter;
|
||||
import org.hibernate.query.sqm.mutation.internal.SqmInsertStrategyHelper;
|
||||
import org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||
import org.hibernate.query.sqm.tree.insert.SqmInsertSelectStatement;
|
||||
import org.hibernate.query.sqm.tree.insert.SqmInsertStatement;
|
||||
import org.hibernate.query.sqm.tree.insert.SqmInsertValuesStatement;
|
||||
|
|
|
@ -6,33 +6,19 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.mutation.internal.temptable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.hibernate.dialect.temptable.TemporaryTable;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
import org.hibernate.metamodel.MappingMetamodel;
|
||||
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||
import org.hibernate.query.sqm.internal.DomainParameterXref;
|
||||
import org.hibernate.query.sqm.internal.SqmJdbcExecutionContextAdapter;
|
||||
import org.hibernate.query.sqm.mutation.internal.MultiTableSqmMutationConverter;
|
||||
import org.hibernate.query.sqm.mutation.internal.UpdateHandler;
|
||||
import org.hibernate.query.sqm.mutation.spi.AbstractMutationHandler;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||
import org.hibernate.query.sqm.tree.predicate.SqmWhereClause;
|
||||
import org.hibernate.query.sqm.tree.update.SqmUpdateStatement;
|
||||
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
|
||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.TableReference;
|
||||
import org.hibernate.sql.ast.tree.from.TableReferenceJoin;
|
||||
|
@ -40,9 +26,13 @@ import org.hibernate.sql.ast.tree.predicate.Predicate;
|
|||
import org.hibernate.sql.ast.tree.predicate.PredicateCollector;
|
||||
import org.hibernate.sql.ast.tree.update.Assignment;
|
||||
import org.hibernate.sql.exec.spi.ExecutionContext;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
|
@ -60,8 +50,6 @@ public class TableBasedUpdateHandler
|
|||
private final Function<SharedSessionContractImplementor,String> sessionUidAccess;
|
||||
private final DomainParameterXref domainParameterXref;
|
||||
|
||||
private final EntityPersister entityDescriptor;
|
||||
|
||||
public TableBasedUpdateHandler(
|
||||
SqmUpdateStatement<?> sqmUpdate,
|
||||
DomainParameterXref domainParameterXref,
|
||||
|
@ -74,9 +62,6 @@ public class TableBasedUpdateHandler
|
|||
this.afterUseAction = afterUseAction;
|
||||
this.sessionUidAccess = sessionUidAccess;
|
||||
this.domainParameterXref = domainParameterXref;
|
||||
|
||||
final String targetEntityName = sqmUpdate.getTarget().getEntityName();
|
||||
this.entityDescriptor = sessionFactory.getRuntimeMetamodels().getMappingMetamodel().getEntityDescriptor( targetEntityName );
|
||||
}
|
||||
|
||||
protected SqmUpdateStatement<?> getSqmUpdate() {
|
||||
|
@ -110,7 +95,7 @@ public class TableBasedUpdateHandler
|
|||
final String rootEntityName = entityDescriptor.getRootEntityName();
|
||||
final EntityPersister rootEntityDescriptor = domainModel.getEntityDescriptor( rootEntityName );
|
||||
|
||||
final String hierarchyRootTableName = ( (Joinable) rootEntityDescriptor ).getTableName();
|
||||
final String hierarchyRootTableName = rootEntityDescriptor.getTableName();
|
||||
|
||||
final MultiTableSqmMutationConverter converterDelegate = new MultiTableSqmMutationConverter(
|
||||
entityDescriptor,
|
||||
|
|
|
@ -58,7 +58,7 @@ import org.hibernate.metamodel.mapping.ModelPartContainer;
|
|||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||
import org.hibernate.metamodel.mapping.SqlTypedMapping;
|
||||
import org.hibernate.persister.entity.AbstractEntityPersister;
|
||||
import org.hibernate.persister.entity.Loadable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.internal.SqlFragmentPredicate;
|
||||
import org.hibernate.query.IllegalQueryOperationException;
|
||||
import org.hibernate.query.ReturnableType;
|
||||
|
@ -8611,8 +8611,8 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
|||
}
|
||||
|
||||
private String[] determineKeyColumnNames(ModelPart modelPart) {
|
||||
if ( modelPart instanceof Loadable ) {
|
||||
return ( (Loadable) modelPart ).getIdentifierColumnNames();
|
||||
if ( modelPart instanceof EntityPersister) {
|
||||
return ( (EntityPersister) modelPart ).getIdentifierColumnNames();
|
||||
}
|
||||
else if ( modelPart instanceof PluralAttributeMapping ) {
|
||||
return ((PluralAttributeMapping) modelPart).getCollectionDescriptor().getKeyColumnAliases( null );
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.hibernate.metamodel.mapping.JdbcMapping;
|
|||
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||
import org.hibernate.metamodel.mapping.MappingType;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Queryable;
|
||||
import org.hibernate.query.sqm.sql.internal.DomainResultProducer;
|
||||
import org.hibernate.sql.ast.SqlAstWalker;
|
||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||
|
@ -35,7 +34,7 @@ public class EntityTypeLiteral
|
|||
|
||||
public EntityTypeLiteral(EntityPersister entityTypeDescriptor) {
|
||||
this.entityTypeDescriptor = entityTypeDescriptor;
|
||||
this.discriminatorType = (DiscriminatorType) ( (Queryable) entityTypeDescriptor ).getTypeDiscriminatorMetadata().getResolutionType();
|
||||
this.discriminatorType = (DiscriminatorType) entityTypeDescriptor.getTypeDiscriminatorMetadata().getResolutionType();
|
||||
}
|
||||
|
||||
public EntityPersister getEntityTypeDescriptor() {
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.hibernate.internal.CoreMessageLogger;
|
|||
import org.hibernate.metamodel.mapping.ModelPart;
|
||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.collection.QueryableCollection;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
|
@ -205,7 +204,7 @@ public class ResultsHelper {
|
|||
|
||||
boolean isPutFromLoad = true;
|
||||
if ( collectionDescriptor.getElementType().isAssociationType() ) {
|
||||
final EntityPersister entityPersister = ( (QueryableCollection) collectionDescriptor ).getElementPersister();
|
||||
final EntityPersister entityPersister = collectionDescriptor.getElementPersister();
|
||||
for ( Object id : entry.getState() ) {
|
||||
if ( persistenceContext.wasInsertedDuringTransaction( entityPersister, id ) ) {
|
||||
isPutFromLoad = false;
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.hibernate.internal.util.collections.ArrayHelper;
|
|||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
import org.hibernate.metamodel.CollectionClassification;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.collection.QueryableCollection;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
|
@ -467,7 +466,7 @@ public abstract class CollectionType extends AbstractType implements Association
|
|||
throws MappingException {
|
||||
try {
|
||||
|
||||
QueryableCollection collectionPersister = (QueryableCollection) factory.getRuntimeMetamodels().getMappingMetamodel().getCollectionDescriptor( role );
|
||||
CollectionPersister collectionPersister = factory.getRuntimeMetamodels().getMappingMetamodel().getCollectionDescriptor( role );
|
||||
|
||||
if ( !collectionPersister.getElementType().isEntityType() ) {
|
||||
throw new MappingException(
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.hibernate.engine.spi.SessionImplementor;
|
|||
import org.hibernate.graph.RootGraph;
|
||||
import org.hibernate.metamodel.CollectionClassification;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.collection.QueryableCollection;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.query.Query;
|
||||
import org.hibernate.sql.SimpleSelect;
|
||||
|
@ -310,9 +309,8 @@ public class OrderByTest extends BaseCoreFunctionalTestCase {
|
|||
s.getTransaction().begin();
|
||||
|
||||
try {
|
||||
final QueryableCollection queryableCollection = (QueryableCollection) transactionsPersister;
|
||||
SimpleSelect select = new SimpleSelect( sessionFactory() )
|
||||
.setTableName( queryableCollection.getTableName() )
|
||||
.setTableName( transactionsPersister.getTableName() )
|
||||
.addColumn( "code" )
|
||||
.addColumn( "transactions_index" );
|
||||
final String sql = select.toStatementString();
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Set;
|
|||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.Filter;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
|
@ -60,6 +61,7 @@ import org.hibernate.metamodel.model.domain.NavigableRole;
|
|||
import org.hibernate.metamodel.spi.EntityRepresentationStrategy;
|
||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.entity.DiscriminatorMetadata;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.UniqueKeyEntry;
|
||||
import org.hibernate.persister.entity.mutation.DeleteCoordinator;
|
||||
|
@ -861,6 +863,91 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
|
|||
public GeneratedValuesMutationDelegate getUpdateDelegate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIdentifierAliases(String suffix) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRootTableName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getRootTableIdentifierColumnNames() {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersionColumnName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertyAliases(String suffix, int i) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDiscriminatorAlias(String suffix) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDiscriminatorColumnName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getDiscriminatorType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRowId() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSubclassPropertyColumnAliases(String propertyName, String suffix) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public FetchMode getFetchMode(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getSubclassPropertyType(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertyColumnNames(String propertyPath) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectFragment(String alias, String suffix) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiscriminatorMetadata getTypeDiscriminatorMetadata() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toColumns(String propertyName) {
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
public static class NoopCollectionPersister implements CollectionPersister {
|
||||
|
@ -1124,5 +1211,30 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
|
|||
public void applyWhereRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, SqlAstCreationState creationState) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifierColumnName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectFragment(String alias, String columnSuffix) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getCollectionPropertyColumnAliases(String propertyName, String string) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPersister getElementPersister() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.hibernate.collection.spi.PersistentList;
|
|||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.collection.QueryableCollection;
|
||||
import org.hibernate.sql.ComparisonRestriction;
|
||||
import org.hibernate.sql.SimpleSelect;
|
||||
|
||||
|
@ -72,9 +71,8 @@ public class PersistentListTest {
|
|||
session2 -> {
|
||||
session2.doWork(
|
||||
connection -> {
|
||||
final QueryableCollection queryableCollection = (QueryableCollection) collectionPersister;
|
||||
SimpleSelect select = new SimpleSelect( sessionFactory )
|
||||
.setTableName( queryableCollection.getTableName() )
|
||||
.setTableName( collectionPersister.getTableName() )
|
||||
.addColumn( "NAME" )
|
||||
.addColumn( "LIST_INDEX" )
|
||||
.addRestriction( "NAME", ComparisonRestriction.Operator.NE, "?" );
|
||||
|
@ -133,9 +131,8 @@ public class PersistentListTest {
|
|||
session2 -> {
|
||||
session2.doWork(
|
||||
connection -> {
|
||||
final QueryableCollection queryableCollection = (QueryableCollection) collectionPersister;
|
||||
SimpleSelect select = new SimpleSelect( sessionFactory )
|
||||
.setTableName( queryableCollection.getTableName() )
|
||||
.setTableName( collectionPersister.getTableName() )
|
||||
.addColumn( "order_id" )
|
||||
.addColumn( "INDX" )
|
||||
.addColumn( "PRD_CODE" );
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.hibernate.annotations.FetchMode;
|
|||
import org.hibernate.engine.FetchStyle;
|
||||
import org.hibernate.engine.FetchTiming;
|
||||
import org.hibernate.metamodel.mapping.internal.FetchOptionsHelper;
|
||||
import org.hibernate.persister.entity.Loadable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.AssociationType;
|
||||
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
|
@ -172,7 +172,7 @@ public class BatchFetchStrategyHelperTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
private org.hibernate.FetchMode determineFetchMode(Class<?> entityClass, String path) {
|
||||
Loadable entityPersister = (Loadable) sessionFactory().getRuntimeMetamodels()
|
||||
EntityPersister entityPersister = sessionFactory().getRuntimeMetamodels()
|
||||
.getMappingMetamodel()
|
||||
.getEntityDescriptor(entityClass.getName());
|
||||
int index = entityPersister.getPropertyIndex( path );
|
||||
|
@ -180,7 +180,7 @@ public class BatchFetchStrategyHelperTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
private AssociationType determineAssociationType(Class<?> entityClass, String path) {
|
||||
Loadable entityPersister = (Loadable) sessionFactory().getRuntimeMetamodels()
|
||||
EntityPersister entityPersister = sessionFactory().getRuntimeMetamodels()
|
||||
.getMappingMetamodel()
|
||||
.getEntityDescriptor(entityClass.getName());
|
||||
int index = entityPersister.getPropertyIndex( path );
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.hibernate.annotations.FetchMode;
|
|||
import org.hibernate.engine.FetchStyle;
|
||||
import org.hibernate.engine.FetchTiming;
|
||||
import org.hibernate.metamodel.mapping.internal.FetchOptionsHelper;
|
||||
import org.hibernate.persister.entity.Loadable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.AssociationType;
|
||||
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
|
@ -168,7 +168,7 @@ public class FetchStrategyHelperTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
private org.hibernate.FetchMode determineFetchMode(Class<?> entityClass, String path) {
|
||||
Loadable entityPersister = (Loadable) sessionFactory().getRuntimeMetamodels()
|
||||
EntityPersister entityPersister = sessionFactory().getRuntimeMetamodels()
|
||||
.getMappingMetamodel()
|
||||
.getEntityDescriptor(entityClass.getName());
|
||||
int index = entityPersister.getPropertyIndex( path );
|
||||
|
@ -176,7 +176,7 @@ public class FetchStrategyHelperTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
private AssociationType determineAssociationType(Class<?> entityClass, String path) {
|
||||
Loadable entityPersister = (Loadable) sessionFactory().getRuntimeMetamodels()
|
||||
EntityPersister entityPersister = sessionFactory().getRuntimeMetamodels()
|
||||
.getMappingMetamodel()
|
||||
.getEntityDescriptor(entityClass.getName());
|
||||
int index = entityPersister.getPropertyIndex( path );
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.hibernate.annotations.Proxy;
|
|||
import org.hibernate.engine.FetchStyle;
|
||||
import org.hibernate.engine.FetchTiming;
|
||||
import org.hibernate.metamodel.mapping.internal.FetchOptionsHelper;
|
||||
import org.hibernate.persister.entity.Loadable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.AssociationType;
|
||||
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
|
@ -89,7 +89,7 @@ public class NoProxyFetchStrategyHelperTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
private org.hibernate.FetchMode determineFetchMode(Class<?> entityClass, String path) {
|
||||
Loadable entityPersister = (Loadable) sessionFactory().getRuntimeMetamodels()
|
||||
EntityPersister entityPersister = sessionFactory().getRuntimeMetamodels()
|
||||
.getMappingMetamodel()
|
||||
.getEntityDescriptor(entityClass.getName());
|
||||
int index = entityPersister.getPropertyIndex( path );
|
||||
|
@ -97,7 +97,7 @@ public class NoProxyFetchStrategyHelperTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
private AssociationType determineAssociationType(Class<?> entityClass, String path) {
|
||||
Loadable entityPersister = (Loadable) sessionFactory().getRuntimeMetamodels()
|
||||
EntityPersister entityPersister = sessionFactory().getRuntimeMetamodels()
|
||||
.getMappingMetamodel()
|
||||
.getEntityDescriptor(entityClass.getName());
|
||||
int index = entityPersister.getPropertyIndex( path );
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Map;
|
|||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
|
@ -59,6 +60,7 @@ import org.hibernate.metamodel.spi.EntityRepresentationStrategy;
|
|||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||
import org.hibernate.orm.test.jpa.SettingsGenerator;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.entity.DiscriminatorMetadata;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.UniqueKeyEntry;
|
||||
import org.hibernate.persister.entity.mutation.DeleteCoordinator;
|
||||
|
@ -892,6 +894,91 @@ public class PersisterClassProviderTest {
|
|||
public GeneratedValuesMutationDelegate getUpdateDelegate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIdentifierAliases(String suffix) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRootTableName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getRootTableIdentifierColumnNames() {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersionColumnName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertyAliases(String suffix, int i) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDiscriminatorAlias(String suffix) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDiscriminatorColumnName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getDiscriminatorType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRowId() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSubclassPropertyColumnAliases(String propertyName, String suffix) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public FetchMode getFetchMode(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getSubclassPropertyType(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertyColumnNames(String propertyPath) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectFragment(String alias, String suffix) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiscriminatorMetadata getTypeDiscriminatorMetadata() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toColumns(String propertyName) {
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
public static class GoofyException extends RuntimeException {
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Objects;
|
|||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
|
@ -58,6 +59,7 @@ import org.hibernate.metamodel.mapping.TableDetails;
|
|||
import org.hibernate.metamodel.model.domain.NavigableRole;
|
||||
import org.hibernate.metamodel.spi.EntityRepresentationStrategy;
|
||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||
import org.hibernate.persister.entity.DiscriminatorMetadata;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.UniqueKeyEntry;
|
||||
import org.hibernate.persister.entity.mutation.DeleteCoordinator;
|
||||
|
@ -1000,4 +1002,89 @@ public class CustomPersister implements EntityPersister {
|
|||
public GeneratedValuesMutationDelegate getUpdateDelegate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIdentifierAliases(String suffix) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRootTableName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getRootTableIdentifierColumnNames() {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersionColumnName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertyAliases(String suffix, int i) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDiscriminatorAlias(String suffix) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDiscriminatorColumnName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getDiscriminatorType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRowId() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSubclassPropertyColumnAliases(String propertyName, String suffix) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public FetchMode getFetchMode(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getSubclassPropertyType(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertyColumnNames(String propertyPath) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectFragment(String alias, String suffix) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiscriminatorMetadata getTypeDiscriminatorMetadata() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toColumns(String propertyName) {
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.hibernate.annotations.Formula;
|
|||
import org.hibernate.persister.entity.AbstractEntityPersister;
|
||||
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.FailureExpected;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
|||
import org.hibernate.loader.ast.spi.AfterLoadAction;
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
import org.hibernate.metamodel.spi.MappingMetamodelImplementor;
|
||||
import org.hibernate.persister.entity.Loadable;
|
||||
import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.sql.ast.spi.SqlAstCreationContext;
|
||||
|
|
|
@ -13,15 +13,13 @@ import java.util.List;
|
|||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||
import org.hibernate.metamodel.mapping.ValuedModelPart;
|
||||
import org.hibernate.metamodel.mapping.ordering.OrderByFragment;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.query.ReturnableType;
|
||||
import org.hibernate.persister.collection.QueryableCollection;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.query.sqm.function.FunctionRenderer;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor;
|
||||
import org.hibernate.query.sqm.function.FunctionRenderingSupport;
|
||||
import org.hibernate.query.sqm.function.SelfRenderingSqmFunction;
|
||||
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
|
||||
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
||||
|
@ -201,7 +199,7 @@ public class OrderByFragmentFunction extends AbstractSqmFunctionDescriptor {
|
|||
final TableGroup tableGroup = ( (FromClauseIndex) walker.getFromClauseAccess() ).findTableGroup(
|
||||
sqmAlias
|
||||
);
|
||||
final QueryableCollection collectionDescriptor = (QueryableCollection) walker.getCreationContext()
|
||||
final CollectionPersister collectionDescriptor = walker.getCreationContext()
|
||||
.getSessionFactory()
|
||||
.getRuntimeMetamodels()
|
||||
.getMappingMetamodel()
|
||||
|
@ -220,7 +218,7 @@ public class OrderByFragmentFunction extends AbstractSqmFunctionDescriptor {
|
|||
targetTableExpression = collectionDescriptor.getTableName();
|
||||
}
|
||||
else {
|
||||
targetTableExpression = ( (Joinable) collectionDescriptor.getElementPersister() ).getTableName();
|
||||
targetTableExpression = collectionDescriptor.getElementPersister().getTableName();
|
||||
}
|
||||
// We apply the fragment here and return null to signal that this is a no-op
|
||||
fragment.apply(
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.hibernate.event.spi.EventSource;
|
|||
import org.hibernate.metamodel.mapping.AttributeMapping;
|
||||
import org.hibernate.metamodel.mapping.ModelPart;
|
||||
import org.hibernate.persister.entity.JoinedSubclassEntityPersister;
|
||||
import org.hibernate.persister.entity.Queryable;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.UnionSubclassEntityPersister;
|
||||
import org.hibernate.property.access.spi.Getter;
|
||||
import org.hibernate.sql.ComparisonRestriction;
|
||||
|
@ -405,8 +405,8 @@ public class ValidityAuditStrategy implements AuditStrategy {
|
|||
return convertRevEndTimestampToDate( value );
|
||||
}
|
||||
|
||||
private Queryable getQueryable(String entityName, SessionImplementor sessionImplementor) {
|
||||
return (Queryable) sessionImplementor.getFactory()
|
||||
private EntityPersister getEntityPersister(String entityName, SessionImplementor sessionImplementor) {
|
||||
return sessionImplementor.getFactory()
|
||||
.getMappingMetamodel()
|
||||
.getEntityDescriptor( entityName );
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ public class ValidityAuditStrategy implements AuditStrategy {
|
|||
Object id,
|
||||
Object revision) {
|
||||
|
||||
Queryable entity = getQueryable( entityName, session );
|
||||
EntityPersister entity = getEntityPersister( entityName, session );
|
||||
final List<UpdateContext> contexts = new ArrayList<>( 0 );
|
||||
|
||||
// HHH-9062 - update inherited
|
||||
|
@ -517,7 +517,7 @@ public class ValidityAuditStrategy implements AuditStrategy {
|
|||
);
|
||||
entityName = entity.getEntityMappingType().getSuperMappingType().getEntityName();
|
||||
auditEntityName = configuration.getAuditEntityName( entityName );
|
||||
entity = getQueryable( entityName, session );
|
||||
entity = getEntityPersister( entityName, session );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -545,11 +545,11 @@ public class ValidityAuditStrategy implements AuditStrategy {
|
|||
Object id,
|
||||
Object revision) {
|
||||
|
||||
final Queryable entity = getQueryable( entityName, session );
|
||||
final Queryable rootEntity = getQueryable( entity.getRootEntityName(), session );
|
||||
final Queryable auditEntity = getQueryable( auditEntityName, session );
|
||||
final Queryable rootAuditEntity = getQueryable( auditEntity.getRootEntityName(), session );
|
||||
final Queryable revisionEntity = getQueryable( configuration.getRevisionInfo().getRevisionInfoEntityName(), session );
|
||||
final EntityPersister entity = getEntityPersister( entityName, session );
|
||||
final EntityPersister rootEntity = getEntityPersister( entity.getRootEntityName(), session );
|
||||
final EntityPersister auditEntity = getEntityPersister( auditEntityName, session );
|
||||
final EntityPersister rootAuditEntity = getEntityPersister( auditEntity.getRootEntityName(), session );
|
||||
final EntityPersister revisionEntity = getEntityPersister( configuration.getRevisionInfo().getRevisionInfoEntityName(), session );
|
||||
|
||||
final Number revisionNumber = getRevisionNumber( configuration, revision );
|
||||
|
||||
|
@ -611,8 +611,8 @@ public class ValidityAuditStrategy implements AuditStrategy {
|
|||
Object id,
|
||||
Object revision) {
|
||||
|
||||
final Queryable entity = getQueryable( entityName, session );
|
||||
final Queryable auditEntity = getQueryable( auditEntityName, session );
|
||||
final EntityPersister entity = getEntityPersister( entityName, session );
|
||||
final EntityPersister auditEntity = getEntityPersister( auditEntityName, session );
|
||||
|
||||
|
||||
// The expected SQL is an update statement as follows:
|
||||
|
@ -651,7 +651,7 @@ public class ValidityAuditStrategy implements AuditStrategy {
|
|||
return reader.getRevisionNumber( revisionEntity );
|
||||
}
|
||||
|
||||
private String getUpdateTableName(Queryable rootEntity, Queryable rootAuditEntity, Queryable auditEntity) {
|
||||
private String getUpdateTableName(EntityPersister rootEntity, EntityPersister rootAuditEntity, EntityPersister auditEntity) {
|
||||
if ( rootEntity instanceof UnionSubclassEntityPersister ) {
|
||||
// we need to specially handle union-subclass mappings
|
||||
return auditEntity.getMappedTableDetails().getTableName();
|
||||
|
|
|
@ -6,11 +6,10 @@
|
|||
*/
|
||||
package org.hibernate.processor.validation;
|
||||
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.persister.collection.QueryableCollection;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.ListType;
|
||||
import org.hibernate.type.MapType;
|
||||
|
@ -23,10 +22,7 @@ import static org.hibernate.processor.validation.MockSessionFactory.typeConfigur
|
|||
* @author Gavin King
|
||||
*/
|
||||
@SuppressWarnings("nullness")
|
||||
public abstract class MockCollectionPersister implements QueryableCollection {
|
||||
|
||||
private static final String[] ID_COLUMN = {"id"};
|
||||
private static final String[] INDEX_COLUMN = {"pos"};
|
||||
public abstract class MockCollectionPersister implements CollectionPersister, Joinable {
|
||||
|
||||
private final String role;
|
||||
private final MockSessionFactory factory;
|
||||
|
@ -51,11 +47,6 @@ public abstract class MockCollectionPersister implements QueryableCollection {
|
|||
return role;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return role;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionType getCollectionType() {
|
||||
return collectionType;
|
||||
|
@ -68,25 +59,6 @@ public abstract class MockCollectionPersister implements QueryableCollection {
|
|||
|
||||
abstract Type getElementPropertyType(String propertyPath);
|
||||
|
||||
@Override
|
||||
public Type toType(String propertyName) throws QueryException {
|
||||
if ("index".equals(propertyName)) {
|
||||
//this is what AbstractCollectionPersister does!
|
||||
//TODO: move it to FromElementType:626 or all
|
||||
// the way to CollectionPropertyMapping
|
||||
return getIndexType();
|
||||
}
|
||||
Type type = getElementPropertyType(propertyName);
|
||||
if (type==null) {
|
||||
throw new QueryException(elementType.getName()
|
||||
+ " has no mapped "
|
||||
+ propertyName);
|
||||
}
|
||||
else {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getKeyType() {
|
||||
return getOwnerEntityPersister().getIdentifierType();
|
||||
|
@ -153,54 +125,8 @@ public abstract class MockCollectionPersister implements QueryableCollection {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIndexColumnNames() {
|
||||
return INDEX_COLUMN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIndexColumnNames(String alias) {
|
||||
return INDEX_COLUMN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIndexFormulas() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getElementColumnNames(String alias) {
|
||||
return new String[] {""};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getElementColumnNames() {
|
||||
return new String[] {""};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FetchMode getFetchMode() {
|
||||
return FetchMode.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return role;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getKeyColumnNames() {
|
||||
return ID_COLUMN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollection() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toColumns(String propertyName) {
|
||||
return new String[] {""};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,11 +7,10 @@
|
|||
package org.hibernate.processor.validation;
|
||||
|
||||
import jakarta.persistence.AccessType;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.persister.entity.DiscriminatorMetadata;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Queryable;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.tuple.entity.EntityMetamodel;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
|
@ -30,7 +29,7 @@ import static org.hibernate.processor.validation.MockSessionFactory.typeConfigur
|
|||
* @author Gavin King
|
||||
*/
|
||||
@SuppressWarnings("nullness")
|
||||
public abstract class MockEntityPersister implements EntityPersister, Queryable, DiscriminatorMetadata {
|
||||
public abstract class MockEntityPersister implements EntityPersister, Joinable, DiscriminatorMetadata {
|
||||
|
||||
private static final String[] ID_COLUMN = {"id"};
|
||||
|
||||
|
@ -91,11 +90,6 @@ public abstract class MockEntityPersister implements EntityPersister, Queryable,
|
|||
return entityName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return entityName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Type getPropertyType(String propertyPath) {
|
||||
Type result = propertyTypesByName.get(propertyPath);
|
||||
|
@ -129,17 +123,6 @@ public abstract class MockEntityPersister implements EntityPersister, Queryable,
|
|||
return "id";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type toType(String propertyName) throws QueryException {
|
||||
Type type = getPropertyType(propertyName);
|
||||
if (type == null) {
|
||||
throw new QueryException(getEntityName()
|
||||
+ " has no mapped "
|
||||
+ propertyName);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRootEntityName() {
|
||||
for (MockEntityPersister persister : factory.getMockEntityPersisters()) {
|
||||
|
@ -162,11 +145,6 @@ public abstract class MockEntityPersister implements EntityPersister, Queryable,
|
|||
return names;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Declarer getSubclassPropertyDeclarer(String s) {
|
||||
return Declarer.CLASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toColumns(String propertyName) {
|
||||
return new String[] { "" };
|
||||
|
@ -187,11 +165,6 @@ public abstract class MockEntityPersister implements EntityPersister, Queryable,
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getKeyColumnNames() {
|
||||
return getIdentifierColumnNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIdentifierColumnNames() {
|
||||
return ID_COLUMN;
|
||||
|
|
Loading…
Reference in New Issue