eliminate casts to AbstractEntityPersister

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-06-03 00:03:30 +02:00 committed by Steve Ebersole
parent ebc253a6f9
commit 61a00b1e6c
35 changed files with 548 additions and 275 deletions

View File

@ -115,9 +115,7 @@ public class WrapVisitor extends ProxyVisitor {
&& ((LazyAttributeLoadingInterceptor)attributeInterceptor).isAttributeLoaded( persister.getAttributeMapping().getAttributeName() ) ) {
final EntityEntry entry = persistenceContext.getEntry( entity );
if ( entry.isExistsInDatabase() ) {
final AbstractEntityPersister entityDescriptor =
(AbstractEntityPersister) persister.getOwnerEntityPersister();
final Object key = entityDescriptor.getCollectionKey(
final Object key = AbstractEntityPersister.getCollectionKey(
persister,
entity,
entry,

View File

@ -60,7 +60,6 @@ import org.hibernate.metamodel.mapping.ValuedModelPart;
import org.hibernate.metamodel.mapping.VirtualModelPart;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.persister.collection.AbstractCollectionPersister;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityNameUse;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.JoinedSubclassEntityPersister;
@ -360,12 +359,11 @@ public class ToOneAttributeMapping
isKeyTableNullable = !persister.getTableName().equals( targetTableName );
}
else {
final AbstractEntityPersister persister = (AbstractEntityPersister) declaringEntityPersister;
final int tableIndex = ArrayHelper.indexOf(
persister.getTableNames(),
declaringEntityPersister.getTableNames(),
targetTableName
);
isKeyTableNullable = persister.isNullableTable( tableIndex );
isKeyTableNullable = declaringEntityPersister.isNullableTable( tableIndex );
}
}
isOptional = ( (ManyToOne) bootValue ).isIgnoreNotFound();
@ -728,8 +726,8 @@ public class ToOneAttributeMapping
}
static String findMapsIdPropertyName(EntityMappingType entityMappingType, String referencedPropertyName) {
final AbstractEntityPersister persister = (AbstractEntityPersister) entityMappingType.getEntityPersister();
if ( Arrays.equals( persister.getKeyColumnNames(), persister.getPropertyColumnNames( referencedPropertyName ) ) ) {
final EntityPersister persister = entityMappingType.getEntityPersister();
if ( Arrays.equals( persister.getIdentifierColumnNames(), persister.getPropertyColumnNames( referencedPropertyName ) ) ) {
return persister.getIdentifierPropertyName();
}
return null;

View File

@ -11,7 +11,7 @@ import org.hibernate.metamodel.mapping.MappingType;
import org.hibernate.metamodel.mapping.ModelPartContainer;
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.metamodel.mapping.ordering.TranslationContext;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.query.NullPrecedence;
import org.hibernate.query.SortDirection;
import org.hibernate.sql.ast.spi.SqlAstCreationState;
@ -119,11 +119,9 @@ public class ColumnReference implements OrderingExpression, SequencePart {
final MappingType elementMappingType = pluralAttribute.getElementDescriptor().getPartMappingType();
if ( elementMappingType instanceof AbstractEntityPersister ) {
final AbstractEntityPersister abstractEntityPersister = (AbstractEntityPersister) elementMappingType;
final int tableNumber = abstractEntityPersister.determineTableNumberForColumn( columnExpression );
final String tableName = abstractEntityPersister.getTableName( tableNumber );
if ( elementMappingType instanceof EntityPersister) {
final EntityPersister entityPersister = (EntityPersister) elementMappingType;
final String tableName = entityPersister.getTableNameForColumn( columnExpression );
return tableGroup.getTableReference( tableGroup.getNavigablePath(), tableName );
}
else {

View File

@ -251,7 +251,6 @@ import org.hibernate.sql.ast.tree.from.StandardTableGroup;
import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.ast.tree.from.TableReference;
import org.hibernate.sql.ast.tree.from.TableReferenceJoin;
import org.hibernate.sql.ast.tree.insert.InsertSelectStatement;
import org.hibernate.sql.ast.tree.predicate.ComparisonPredicate;
import org.hibernate.sql.ast.tree.predicate.InListPredicate;
import org.hibernate.sql.ast.tree.predicate.Junction;
@ -527,7 +526,7 @@ public abstract class AbstractEntityPersister
assert javaType != null;
this.implementsLifecycle = Lifecycle.class.isAssignableFrom( javaType.getJavaTypeClass() );
concreteProxy = isPolymorphic()
concreteProxy = entityMetamodel.isPolymorphic()
&& ( getBytecodeEnhancementMetadata().isEnhancedForLazyLoading() || hasProxy() )
&& persistentClass.isConcreteProxy();
@ -942,8 +941,6 @@ public abstract class AbstractEntityPersister
return queryCacheLayout == CacheLayout.SHALLOW_WITH_DISCRIMINATOR;
}
public abstract String getSubclassTableName(int j);
protected abstract String[] getSubclassTableNames();
protected abstract String[] getSubclassTableKeyColumns(int j);
@ -966,37 +963,12 @@ public abstract class AbstractEntityPersister
return isClassOrSuperclassTable( j );
}
public abstract int getSubclassTableSpan();
public abstract int getTableSpan();
public abstract boolean hasDuplicateTables();
/**
* @deprecated Only ever used from places where we really want to use<ul>
* <li>{@link SelectStatement} (select generator)</li>
* <li>{@link InsertSelectStatement}</li>
* <li>{@link org.hibernate.sql.ast.tree.update.UpdateStatement}</li>
* <li>{@link org.hibernate.sql.ast.tree.delete.DeleteStatement}</li>
* </ul>
*/
@Deprecated( since = "6.2" )
public abstract String getTableName(int j);
public abstract String[] getKeyColumns(int j);
public abstract boolean isPropertyOfTable(int property, int j);
protected abstract int[] getPropertyTableNumbers();
private static final String DISCRIMINATOR_ALIAS = "clazz_";
/**
* The name of the table to use when performing mutations (INSERT,UPDATE,DELETE)
* for the given attribute
*/
public abstract String getAttributeMutationTableName(int i);
@Override
public String getDiscriminatorColumnName() {
return DISCRIMINATOR_ALIAS;
@ -1016,10 +988,12 @@ public abstract class AbstractEntityPersister
return null;
}
@Override
public boolean isInverseTable(int j) {
return false;
}
@Override
public boolean isNullableTable(int j) {
return false;
}
@ -1033,6 +1007,7 @@ public abstract class AbstractEntityPersister
return entityMetamodel.getSubclassEntityNames().contains( entityName );
}
@Override
public boolean isSharedColumn(String columnExpression) {
return sharedColumnNames.contains( columnExpression );
}
@ -1087,6 +1062,7 @@ public abstract class AbstractEntityPersister
return rowIdName != null;
}
@Override
public String[] getTableNames() {
final String[] tableNames = new String[getTableSpan()];
for ( int i = 0; i < tableNames.length; i++ ) {
@ -1403,7 +1379,7 @@ public abstract class AbstractEntityPersister
generateJoinPredicate(
lhs,
joinedTableReference,
getKeyColumnNames(),
getIdentifierColumnNames(),
targetColumns,
creationState
)
@ -1555,7 +1531,7 @@ public abstract class AbstractEntityPersister
}
public @Nullable Object getCollectionKey(
public @Nullable static Object getCollectionKey(
CollectionPersister persister,
Object owner,
EntityEntry ownerEntry,
@ -2275,20 +2251,20 @@ public abstract class AbstractEntityPersister
return hasFormulaProperties;
}
@Override
public FetchMode getFetchMode(int i) {
return subclassPropertyFetchModeClosure[i];
}
@Override
public Type getSubclassPropertyType(int i) {
return subclassPropertyTypeClosure[i];
}
@Override
public int countSubclassProperties() {
return subclassPropertyTypeClosure.length;
}
@Override
public String[] getSubclassPropertyColumnNames(int i) {
return subclassPropertyColumnNameClosure[i];
}
@ -2647,17 +2623,6 @@ public abstract class AbstractEntityPersister
return select.toStatementString();
}
@Internal
public boolean hasLazyDirtyFields(int[] dirtyFields) {
final boolean[] propertyLaziness = getPropertyLaziness();
for ( int i = 0; i < dirtyFields.length; i++ ) {
if ( propertyLaziness[dirtyFields[i]] ) {
return true;
}
}
return false;
}
@Override
public GeneratedValuesMutationDelegate getInsertDelegate() {
return insertDelegate;
@ -2668,11 +2633,12 @@ public abstract class AbstractEntityPersister
return updateDelegate;
}
protected EntityTableMapping[] getTableMappings() {
@Override
public EntityTableMapping[] getTableMappings() {
return tableMappings;
}
public EntityTableMapping getTableMapping(int i) {
protected EntityTableMapping getTableMapping(int i) {
return tableMappings[i];
}
@ -2680,22 +2646,12 @@ public abstract class AbstractEntityPersister
* Unfortunately we cannot directly use `SelectableMapping#getContainingTableExpression()`
* as that blows up for attributes declared on super-type for union-subclass mappings
*/
@Override
public String physicalTableNameForMutation(SelectableMapping selectableMapping) {
assert !selectableMapping.isFormula();
return selectableMapping.getContainingTableExpression();
}
public EntityTableMapping getPhysicalTableMappingForMutation(SelectableMapping selectableMapping) {
final String tableNameForMutation = physicalTableNameForMutation( selectableMapping );
for ( int i = 0; i < tableMappings.length; i++ ) {
if ( tableNameForMutation.equals( tableMappings[i].getTableName() ) ) {
return tableMappings[i];
}
}
throw new IllegalArgumentException( "Unable to resolve TableMapping for selectable - " + selectableMapping );
}
@Override
public EntityMappingType getTargetPart() {
return this;
@ -2863,7 +2819,7 @@ public abstract class AbstractEntityPersister
joinedTableReference,
needsDiscriminator()
? getRootTableKeyColumnNames()
: getKeyColumnNames(),
: getIdentifierColumnNames(),
getSubclassTableKeyColumns( i ),
creationState
)
@ -3256,8 +3212,6 @@ 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;
@ -3496,9 +3450,11 @@ public abstract class AbstractEntityPersister
}
}
@Override
public void addDiscriminatorToInsertGroup(MutationGroupBuilder insertGroupBuilder) {
}
@Override
public void addSoftDeleteToInsertGroup(MutationGroupBuilder insertGroupBuilder) {
if ( softDeleteMapping != null ) {
final TableInsertBuilder insertBuilder = insertGroupBuilder.getTableDetailsBuilder( getIdentifierTableName() );
@ -3805,10 +3761,6 @@ public abstract class AbstractEntityPersister
return entityMetamodel.getName();
}
public boolean isPolymorphic() {
return entityMetamodel.isPolymorphic();
}
@Override
public boolean isInherited() {
return entityMetamodel.isInherited();
@ -4047,10 +3999,6 @@ public abstract class AbstractEntityPersister
return concreteTypeLoader.getConcreteType( id, session );
}
public String[] getKeyColumnNames() {
return getIdentifierColumnNames();
}
/**
* {@inheritDoc}
*
@ -4169,6 +4117,7 @@ public abstract class AbstractEntityPersister
return entityMetamodel.getPropertyCheckability();
}
@Override
public boolean[] getNonLazyPropertyUpdateability() {
return entityMetamodel.getNonlazyPropertyUpdateability();
}
@ -4418,6 +4367,7 @@ public abstract class AbstractEntityPersister
return this;
}
@Override
public boolean hasMultipleTables() {
return false;
}
@ -4638,7 +4588,12 @@ public abstract class AbstractEntityPersister
return entityMetamodel.getBytecodeEnhancementMetadata();
}
public int determineTableNumberForColumn(String columnName) {
@Override
public String getTableNameForColumn(String columnName) {
return getTableName( determineTableNumberForColumn( columnName ) );
}
protected int determineTableNumberForColumn(String columnName) {
return 0;
}

View File

@ -12,7 +12,6 @@ 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;
@ -58,6 +57,8 @@ import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
import org.hibernate.sql.ast.spi.SqlAliasStemHelper;
import org.hibernate.sql.ast.tree.from.RootTableGroupProducer;
import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.ast.tree.insert.InsertSelectStatement;
import org.hibernate.sql.ast.tree.select.SelectStatement;
import org.hibernate.tuple.entity.EntityMetamodel;
import org.hibernate.type.BasicType;
import org.hibernate.type.Type;
@ -796,7 +797,11 @@ public interface EntityPersister extends EntityMappingType, EntityMutationTarget
* (is the property optimistic-locked)
*/
boolean[] getPropertyVersionability();
boolean[] getPropertyLaziness();
boolean[] getNonLazyPropertyUpdateability();
/**
* Get the cascade styles of the properties (optional operation)
*/
@ -1360,6 +1365,37 @@ public interface EntityPersister extends EntityMappingType, EntityMutationTarget
*/
String getDiscriminatorAlias(String suffix);
boolean hasMultipleTables();
String[] getTableNames();
/**
* @deprecated Only ever used from places where we really want to use<ul>
* <li>{@link SelectStatement} (select generator)</li>
* <li>{@link InsertSelectStatement}</li>
* <li>{@link org.hibernate.sql.ast.tree.update.UpdateStatement}</li>
* <li>{@link org.hibernate.sql.ast.tree.delete.DeleteStatement}</li>
* </ul>
*/
@Deprecated( since = "6.2" )
String getTableName(int j);
String[] getKeyColumns(int j);
int getTableSpan();
boolean isInverseTable(int j);
boolean isNullableTable(int j);
boolean hasDuplicateTables();
int getSubclassTableSpan();
String getSubclassTableName(int j);
String getTableNameForColumn(String columnName);
/**
* @return the column name for the discriminator as specified in the mapping.
*
@ -1378,20 +1414,14 @@ public interface EntityPersister extends EntityMappingType, EntityMutationTarget
*/
boolean hasRowId();
String[] getSubclassPropertyColumnNames(int i);
/**
* 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);
int countSubclassProperties();
/**
* Get the column names for the given property path
@ -1413,6 +1443,13 @@ public interface EntityPersister extends EntityMappingType, EntityMutationTarget
/**
* Given a property path, return the corresponding column name(s).
*
* @deprecated No longer used in ORM core
*/
@Deprecated(since = "7.0", forRemoval = true)
String[] toColumns(String propertyName);
boolean isSharedColumn(String columnExpression);
String[][] getConstraintOrderedTableKeyColumnClosure();
}

View File

@ -960,12 +960,12 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
}
@Override
public String[][] getContraintOrderedTableKeyColumnClosure() {
public String[][] getConstraintOrderedTableKeyColumnClosure() {
return constraintOrderedKeyColumnNames;
}
@Override
public int determineTableNumberForColumn(String columnName) {
protected int determineTableNumberForColumn(String columnName) {
// HHH-7630: In case the naturalOrder/identifier column is explicitly given in the ordering, check here.
for ( int i = 0, max = naturalOrderTableKeyColumns.length; i < max; i++ ) {
final String[] keyColumns = naturalOrderTableKeyColumns[i];

View File

@ -559,7 +559,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
}
@Override
public String[][] getContraintOrderedTableKeyColumnClosure() {
public String[][] getConstraintOrderedTableKeyColumnClosure() {
return constraintOrderedKeyColumnNames;
}

View File

@ -514,9 +514,9 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
subMappingTypesAndThis.add( this );
subMappingTypesAndThis.addAll( subMappingTypes );
for ( EntityMappingType mappingType : subMappingTypesAndThis ) {
final AbstractEntityPersister persister = (AbstractEntityPersister) mappingType;
final EntityPersister persister = (EntityPersister) mappingType;
final String subclassTableName;
if ( persister.hasSubclasses() ) {
if ( mappingType.hasSubclasses() ) {
subclassTableName = persister.getRootTableName();
}
else {
@ -624,7 +624,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
}
@Override
public String[][] getContraintOrderedTableKeyColumnClosure() {
public String[][] getConstraintOrderedTableKeyColumnClosure() {
return constraintOrderedKeyColumnNames;
}

View File

@ -17,9 +17,8 @@ import org.hibernate.engine.spi.PersistenceContext;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.EntityRowIdMapping;
import org.hibernate.metamodel.mapping.EntityVersionMapping;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.sql.model.MutationOperation;
import org.hibernate.sql.model.MutationOperationGroup;
@ -40,7 +39,7 @@ public abstract class AbstractDeleteCoordinator
private MutationOperationGroup noVersionDeleteGroup;
public AbstractDeleteCoordinator(
AbstractEntityPersister entityPersister,
EntityPersister entityPersister,
SessionFactoryImplementor factory) {
super( entityPersister, factory );
@ -169,7 +168,7 @@ public abstract class AbstractDeleteCoordinator
SharedSessionContractImplementor session,
JdbcValueBindings jdbcValueBindings) {
if ( loadedState != null ) {
final AbstractEntityPersister persister = entityPersister();
final EntityPersister persister = entityPersister();
final boolean[] versionability = persister.getPropertyVersionability();
for ( int attributeIndex = 0; attributeIndex < versionability.length; attributeIndex++ ) {
final AttributeMapping attribute;
@ -206,7 +205,7 @@ public abstract class AbstractDeleteCoordinator
private void applyVersionLocking(
Object version,
JdbcValueBindings jdbcValueBindings) {
final AbstractEntityPersister persister = entityPersister();
final EntityPersister persister = entityPersister();
final EntityVersionMapping versionMapping = persister.getVersionMapping();
if ( version != null && versionMapping != null ) {
jdbcValueBindings.bindValue(
@ -225,7 +224,7 @@ public abstract class AbstractDeleteCoordinator
MutationOperationGroup operationGroup,
SharedSessionContractImplementor session) {
final JdbcValueBindings jdbcValueBindings = mutationExecutor.getJdbcValueBindings();
final EntityRowIdMapping rowIdMapping = entityPersister().getRowIdMapping();
// final EntityRowIdMapping rowIdMapping = entityPersister().getRowIdMapping();
for ( int position = 0; position < operationGroup.getNumberOfOperations(); position++ ) {
final MutationOperation jdbcMutation = operationGroup.getOperation( position );

View File

@ -19,7 +19,7 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.generator.OnExecutionGenerator;
import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.AttributeMappingsList;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.sql.model.ModelMutationLogging;
import org.hibernate.sql.model.MutationOperation;
import org.hibernate.sql.model.MutationOperationGroup;
@ -34,25 +34,26 @@ import org.hibernate.sql.model.internal.MutationOperationGroupFactory;
/**
* Base support for coordinating mutations against an entity
*
* @implNote Split simply to help minimize the size of {@link AbstractEntityPersister}
* @implNote Split simply to help minimize the size of
* {@link org.hibernate.persister.entity.AbstractEntityPersister}
*
* @author Steve Ebersole
*/
@Internal
public abstract class AbstractMutationCoordinator {
protected final AbstractEntityPersister entityPersister;
protected final EntityPersister entityPersister;
protected final SessionFactoryImplementor factory;
protected final MutationExecutorService mutationExecutorService;
protected final Dialect dialect;
public AbstractMutationCoordinator(AbstractEntityPersister entityPersister, SessionFactoryImplementor factory) {
public AbstractMutationCoordinator(EntityPersister entityPersister, SessionFactoryImplementor factory) {
this.entityPersister = entityPersister;
this.factory = factory;
dialect = factory.getJdbcServices().getDialect();
this.mutationExecutorService = factory.getServiceRegistry().getService( MutationExecutorService.class );
}
protected AbstractEntityPersister entityPersister() {
protected EntityPersister entityPersister() {
return entityPersister;
}
@ -140,7 +141,7 @@ public abstract class AbstractMutationCoordinator {
Object[] loadedState,
SharedSessionContractImplementor session,
JdbcValueBindings jdbcValueBindings) {
final AbstractEntityPersister persister = entityPersister();
final EntityPersister persister = entityPersister();
if ( persister.hasPartitionedSelectionMapping() ) {
final AttributeMappingsList attributeMappings = persister.getAttributeMappings();
final int size = attributeMappings.size();
@ -168,13 +169,13 @@ public abstract class AbstractMutationCoordinator {
}
}
protected static boolean needsRowId(AbstractEntityPersister entityPersister, EntityTableMapping tableMapping) {
protected static boolean needsRowId(EntityPersister entityPersister, EntityTableMapping tableMapping) {
return entityPersister.getRowIdMapping() != null && tableMapping.isIdentifierTable();
}
protected static void applyKeyRestriction(
Object rowId,
AbstractEntityPersister entityPersister,
EntityPersister entityPersister,
RestrictedTableMutationBuilder<?, ?> tableMutationBuilder,
EntityTableMapping tableMapping) {
if ( rowId != null && needsRowId( entityPersister, tableMapping ) ) {

View File

@ -13,7 +13,7 @@ import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.AttributeMappingsList;
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.metamodel.mapping.SoftDeleteMapping;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.sql.model.MutationOperation;
import org.hibernate.sql.model.MutationOperationGroup;
import org.hibernate.sql.model.MutationType;
@ -30,7 +30,7 @@ import org.hibernate.sql.model.internal.MutationOperationGroupFactory;
* @author Steve Ebersole
*/
public class DeleteCoordinatorSoft extends AbstractDeleteCoordinator {
public DeleteCoordinatorSoft(AbstractEntityPersister entityPersister, SessionFactoryImplementor factory) {
public DeleteCoordinatorSoft(EntityPersister entityPersister, SessionFactoryImplementor factory) {
super( entityPersister, factory );
}
@ -64,7 +64,7 @@ public class DeleteCoordinatorSoft extends AbstractDeleteCoordinator {
}
private void applyPartitionKeyRestriction(TableUpdateBuilder<?> tableUpdateBuilder) {
final AbstractEntityPersister persister = entityPersister();
final EntityPersister persister = entityPersister();
if ( persister.hasPartitionedSelectionMapping() ) {
final AttributeMappingsList attributeMappings = persister.getAttributeMappings();
for ( int m = 0; m < attributeMappings.size(); m++ ) {
@ -125,7 +125,7 @@ public class DeleteCoordinatorSoft extends AbstractDeleteCoordinator {
TableUpdateBuilderStandard<MutationOperation> tableUpdateBuilder,
Object[] loadedState,
SharedSessionContractImplementor session) {
final AbstractEntityPersister persister = entityPersister();
final EntityPersister persister = entityPersister();
assert loadedState != null;
assert lockStyle.isAllOrDirty();
assert persister.optimisticLockStyle().isAllOrDirty();

View File

@ -12,7 +12,7 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.AttributeMappingsList;
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.sql.model.MutationOperationGroup;
import org.hibernate.sql.model.MutationType;
import org.hibernate.sql.model.ast.ColumnValueBindingList;
@ -29,7 +29,7 @@ import org.hibernate.sql.model.ast.builder.TableDeleteBuilderStandard;
*/
public class DeleteCoordinatorStandard extends AbstractDeleteCoordinator {
public DeleteCoordinatorStandard(AbstractEntityPersister entityPersister, SessionFactoryImplementor factory) {
public DeleteCoordinatorStandard(EntityPersister entityPersister, SessionFactoryImplementor factory) {
super( entityPersister, factory );
}
@ -69,7 +69,7 @@ public class DeleteCoordinatorStandard extends AbstractDeleteCoordinator {
if ( applyVersion ) {
// apply any optimistic locking
applyOptimisticLocking( deleteGroupBuilder, loadedState, session );
final AbstractEntityPersister persister = entityPersister();
final EntityPersister persister = entityPersister();
if ( persister.hasPartitionedSelectionMapping() ) {
final AttributeMappingsList attributeMappings = persister.getAttributeMappings();
for ( int m = 0; m < attributeMappings.size(); m++ ) {
@ -122,7 +122,7 @@ public class DeleteCoordinatorStandard extends AbstractDeleteCoordinator {
MutationGroupBuilder mutationGroupBuilder,
Object[] loadedState,
SharedSessionContractImplementor session) {
final AbstractEntityPersister persister = entityPersister();
final EntityPersister persister = entityPersister();
assert loadedState != null;
assert lockStyle.isAllOrDirty();
assert persister.optimisticLockStyle().isAllOrDirty();

View File

@ -7,14 +7,17 @@
package org.hibernate.persister.entity.mutation;
import org.hibernate.Incubating;
import org.hibernate.Internal;
import org.hibernate.annotations.Table;
import org.hibernate.engine.jdbc.mutation.MutationExecutor;
import org.hibernate.generator.values.GeneratedValuesMutationDelegate;
import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.sql.model.MutationTarget;
import org.hibernate.sql.model.MutationType;
import org.hibernate.sql.model.ast.builder.MutationGroupBuilder;
/**
* Anything that can be the target of {@linkplain MutationExecutor mutations}
@ -30,11 +33,26 @@ public interface EntityMutationTarget extends MutationTarget<EntityTableMapping>
@Override
EntityTableMapping getIdentifierTableMapping();
@Internal
EntityTableMapping[] getTableMappings();
/**
* The ModelPart describing the identifier/key for this target
*/
ModelPart getIdentifierDescriptor();
String physicalTableNameForMutation(SelectableMapping selectableMapping);
void addDiscriminatorToInsertGroup(MutationGroupBuilder insertGroupBuilder);
void addSoftDeleteToInsertGroup(MutationGroupBuilder insertGroupBuilder);
/**
* The name of the table to use when performing mutations (INSERT,UPDATE,DELETE)
* for the given attribute
*/
String getAttributeMutationTableName(int i);
/**
* Whether this target defines any potentially skippable tables.
* <p>
@ -43,7 +61,10 @@ public interface EntityMutationTarget extends MutationTarget<EntityTableMapping>
*
* @see Table#inverse
* @see Table#optional
*
* @deprecated No longer called
*/
@Deprecated(since = "7.0", forRemoval = true)
boolean hasSkippableTables();
/**

View File

@ -28,7 +28,7 @@ import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.AttributeMappingsList;
import org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping;
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.sql.model.MutationOperation;
import org.hibernate.sql.model.MutationOperationGroup;
import org.hibernate.sql.model.MutationType;
@ -56,7 +56,7 @@ public class InsertCoordinatorStandard extends AbstractMutationCoordinator imple
private final MutationOperationGroup staticInsertGroup;
private final BasicBatchKey batchKey;
public InsertCoordinatorStandard(AbstractEntityPersister entityPersister, SessionFactoryImplementor factory) {
public InsertCoordinatorStandard(EntityPersister entityPersister, SessionFactoryImplementor factory) {
super( entityPersister, factory );
if ( entityPersister.isIdentifierAssignedByInsert() || entityPersister.hasInsertGeneratedProperties() ) {
@ -131,7 +131,7 @@ public class InsertCoordinatorStandard extends AbstractMutationCoordinator imple
}
protected boolean preInsertInMemoryValueGeneration(Object[] values, Object entity, SharedSessionContractImplementor session) {
final AbstractEntityPersister persister = entityPersister();
final EntityPersister persister = entityPersister();
final EntityMetamodel entityMetamodel = persister.getEntityMetamodel();
boolean foundStateDependentGenerator = false;
if ( entityMetamodel.hasPreInsertGeneratedValues() ) {

View File

@ -7,7 +7,7 @@
package org.hibernate.persister.entity.mutation;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.sql.model.MutationOperation;
import org.hibernate.sql.model.ast.builder.AbstractTableUpdateBuilder;
import org.hibernate.sql.model.ast.builder.TableMergeBuilder;
@ -19,7 +19,7 @@ import org.hibernate.sql.model.ast.builder.TableMergeBuilder;
*/
public class MergeCoordinator extends UpdateCoordinatorStandard {
public MergeCoordinator(AbstractEntityPersister entityPersister, SessionFactoryImplementor factory) {
public MergeCoordinator(EntityPersister entityPersister, SessionFactoryImplementor factory) {
super(entityPersister, factory);
}

View File

@ -7,9 +7,9 @@
package org.hibernate.persister.entity.mutation;
import org.hibernate.generator.values.GeneratedValues;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.sql.model.internal.MutationOperationGroupFactory;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.sql.model.MutationOperationGroup;
import org.hibernate.sql.model.MutationType;
@ -19,7 +19,7 @@ import org.hibernate.sql.model.MutationType;
public class UpdateCoordinatorNoOp implements UpdateCoordinator {
private final MutationOperationGroup operationGroup;
public UpdateCoordinatorNoOp(AbstractEntityPersister entityPersister) {
public UpdateCoordinatorNoOp(EntityPersister entityPersister) {
operationGroup = MutationOperationGroupFactory.noOperations( MutationType.UPDATE, entityPersister );
}

View File

@ -40,7 +40,6 @@ import org.hibernate.metamodel.mapping.AttributeMappingsList;
import org.hibernate.metamodel.mapping.EntityVersionMapping;
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.metamodel.mapping.SingularAttributeMapping;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.sql.model.MutationOperation;
import org.hibernate.sql.model.MutationOperationGroup;
@ -73,11 +72,7 @@ import static org.hibernate.internal.util.collections.ArrayHelper.trim;
* @author Steve Ebersole
*/
public class UpdateCoordinatorStandard extends AbstractMutationCoordinator implements UpdateCoordinator {
// `org.hibernate.orm.test.mapping.onetoone.OneToOneMapsIdChangeParentTest#test` expects
// the logger-name to be AbstractEntityPersister
// todo (mutation) : Change this? It is an interesting "api" question wrt logging
// private static final CoreMessageLogger LOG = CoreLogging.messageLogger( UpdateCoordinatorStandard.class );
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( AbstractEntityPersister.class );
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( UpdateCoordinatorStandard.class );
private final MutationOperationGroup staticUpdateGroup;
private final BatchKey batchKey;
@ -85,7 +80,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
private final MutationOperationGroup versionUpdateGroup;
private final BatchKey versionUpdateBatchkey;
public UpdateCoordinatorStandard(AbstractEntityPersister entityPersister, SessionFactoryImplementor factory) {
public UpdateCoordinatorStandard(EntityPersister entityPersister, SessionFactoryImplementor factory) {
super( entityPersister, factory );
// NOTE : even given dynamic-update and/or dirty optimistic locking
@ -105,7 +100,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
//Used by Hibernate Reactive to efficiently create new instances of this same class
protected UpdateCoordinatorStandard(
AbstractEntityPersister entityPersister,
EntityPersister entityPersister,
SessionFactoryImplementor factory,
MutationOperationGroup staticUpdateGroup,
BatchKey batchKey,
@ -216,7 +211,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
}
else if ( dirtyAttributeIndexes != null
&& entityPersister().hasUninitializedLazyProperties( entity )
&& entityPersister().hasLazyDirtyFields( dirtyAttributeIndexes ) ) {
&& hasLazyDirtyFields( entityPersister(), dirtyAttributeIndexes ) ) {
// we have an entity with dirty lazy attributes. we need to use dynamic
// delete and add the dirty, lazy attributes plus the non-lazy attributes
forceDynamicUpdate = true;
@ -615,7 +610,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
Object rowId,
boolean forceDynamicUpdate,
SharedSessionContractImplementor session) {
final AbstractEntityPersister persister = entityPersister();
final EntityPersister persister = entityPersister();
final AttributeMappingsList attributeMappings = persister.getAttributeMappings();
// NOTE:
@ -719,7 +714,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
private void processSet(UpdateValuesAnalysisImpl analysis, SelectableMapping selectable, boolean needsDynamicUpdate) {
if ( selectable != null && !selectable.isFormula() && selectable.isUpdateable() ) {
final EntityTableMapping tableMapping = entityPersister().getPhysicalTableMappingForMutation( selectable );
final EntityTableMapping tableMapping = physicalTableMappingForMutation( entityPersister(), selectable );
analysis.registerColumnSet( tableMapping, selectable.getSelectionExpression(), selectable.getWriteExpression() );
if ( needsDynamicUpdate ) {
analysis.getTablesNeedingDynamicUpdate().add( tableMapping );
@ -739,7 +734,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
null,
(valueIndex, updateAnalysis, noop, jdbcValue, columnMapping) -> {
if ( !columnMapping.isFormula() ) {
final EntityTableMapping tableMapping = entityPersister().getPhysicalTableMappingForMutation( columnMapping );
final EntityTableMapping tableMapping = physicalTableMappingForMutation( entityPersister(), columnMapping );
updateAnalysis.registerColumnOptLock( tableMapping, columnMapping.getSelectionExpression(), jdbcValue );
}
},
@ -1151,7 +1146,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
}
private void applyPartitionKeyRestriction(TableUpdateBuilder<?> tableUpdateBuilder) {
final AbstractEntityPersister persister = entityPersister();
final EntityPersister persister = entityPersister();
if ( persister.hasPartitionedSelectionMapping() ) {
final AttributeMappingsList attributeMappings = persister.getAttributeMappings();
for ( int m = 0; m < attributeMappings.size(); m++ ) {
@ -1698,6 +1693,29 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
AttributeAnalysis.DirtynessStatus isDirty(int position, AttributeMapping attribute);
}
public boolean hasLazyDirtyFields(EntityPersister persister, int[] dirtyFields) {
final boolean[] propertyLaziness = persister.getPropertyLaziness();
for ( int i = 0; i < dirtyFields.length; i++ ) {
if ( propertyLaziness[dirtyFields[i]] ) {
return true;
}
}
return false;
}
public EntityTableMapping physicalTableMappingForMutation(
EntityPersister persister, SelectableMapping selectableMapping) {
final String tableNameForMutation = persister.physicalTableNameForMutation( selectableMapping );
final EntityTableMapping[] tableMappings = persister.getTableMappings();
for ( int i = 0; i < tableMappings.length; i++ ) {
if ( tableNameForMutation.equals( tableMappings[i].getTableName() ) ) {
return tableMappings[i];
}
}
throw new IllegalArgumentException( "Unable to resolve TableMapping for selectable - " + selectableMapping );
}
@Override
public String toString() {
return "UpdateCoordinatorStandard(" + entityPersister().getEntityName() + ")";

View File

@ -85,8 +85,8 @@ public class AnonymousTupleEntityValuedModelPart
private final DomainType<?> domainType;
private final String componentName;
private final EntityValuedModelPart delegate;
private final Set<String> targetKeyPropertyNames;
private final int fetchableIndex;
// private final Set<String> targetKeyPropertyNames;
// private final int fetchableIndex;
public AnonymousTupleEntityValuedModelPart(
EntityIdentifierMapping identifierMapping,
@ -108,8 +108,8 @@ public class AnonymousTupleEntityValuedModelPart
persister.getIdentifierType(),
persister.getFactory()
);
this.targetKeyPropertyNames = targetKeyPropertyNames;
this.fetchableIndex = fetchableIndex;
// this.targetKeyPropertyNames = targetKeyPropertyNames;
// this.fetchableIndex = fetchableIndex;
}
public ModelPart getForeignKeyPart() {
@ -380,7 +380,7 @@ public class AnonymousTupleEntityValuedModelPart
}
);
}
Consumer<TableGroup> tableGroupInitializerCallback = tg -> {
return tg -> {
this.identifierMapping.forEachSelectable(
(i, selectableMapping) -> {
final SelectableMapping targetMapping = targetMappings.get( i );
@ -401,7 +401,6 @@ public class AnonymousTupleEntityValuedModelPart
}
);
};
return tableGroupInitializerCallback;
}
public TableGroup createTableGroupInternal(
@ -487,7 +486,8 @@ public class AnonymousTupleEntityValuedModelPart
public boolean canUseParentTableGroup(TableGroupProducer producer, NavigablePath navigablePath, ValuedModelPart valuedModelPart) {
final ModelPart foreignKeyPart = getForeignKeyPart();
if ( foreignKeyPart instanceof AnonymousTupleNonAggregatedEntityIdentifierMapping ) {
final AnonymousTupleNonAggregatedEntityIdentifierMapping identifierMapping = (AnonymousTupleNonAggregatedEntityIdentifierMapping) foreignKeyPart;
final AnonymousTupleNonAggregatedEntityIdentifierMapping identifierMapping =
(AnonymousTupleNonAggregatedEntityIdentifierMapping) foreignKeyPart;
final int numberOfFetchables = identifierMapping.getNumberOfFetchables();
for ( int i = 0; i< numberOfFetchables; i++ ) {
if ( valuedModelPart == identifierMapping.getFetchable( i ) ) {
@ -723,8 +723,7 @@ public class AnonymousTupleEntityValuedModelPart
@Override
public boolean isSimpleJoinPredicate(Predicate predicate) {
return delegate instanceof TableGroupJoinProducer
? ( (TableGroupJoinProducer) delegate ).isSimpleJoinPredicate( predicate )
: false;
&& ( (TableGroupJoinProducer) delegate ).isSimpleJoinPredicate(predicate);
}
@Override

View File

@ -24,7 +24,6 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.loader.NonUniqueDiscoveredSqlAliasException;
import org.hibernate.metamodel.mapping.BasicValuedMapping;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.query.named.NamedResultSetMappingMemento;
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
@ -256,17 +255,16 @@ public class ResultSetMappingImpl implements ResultSetMapping {
if ( polymorphic && ( legacyFetchBuilders == null || legacyFetchBuilders.isEmpty() )
&& !entityResult.hasJoinFetches() ) {
final Set<String> aliases = new TreeSet<>( String.CASE_INSENSITIVE_ORDER );
final AbstractEntityPersister entityPersister = (AbstractEntityPersister) persister;
for ( String[] columns : entityPersister.getContraintOrderedTableKeyColumnClosure() ) {
for ( String[] columns : persister.getConstraintOrderedTableKeyColumnClosure() ) {
addColumns( aliases, knownDuplicateAliases, columns );
}
addColumn( aliases, knownDuplicateAliases, entityPersister.getDiscriminatorColumnName() );
addColumn( aliases, knownDuplicateAliases, entityPersister.getVersionColumnName() );
for ( int i = 0; i < entityPersister.countSubclassProperties(); i++ ) {
addColumn( aliases, knownDuplicateAliases, persister.getDiscriminatorColumnName() );
addColumn( aliases, knownDuplicateAliases, persister.getVersionColumnName() );
for (int i = 0; i < persister.countSubclassProperties(); i++ ) {
addColumns(
aliases,
knownDuplicateAliases,
entityPersister.getSubclassPropertyColumnNames( i )
persister.getSubclassPropertyColumnNames( i )
);
}
}

View File

@ -40,7 +40,6 @@ import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
import org.hibernate.metamodel.mapping.internal.SingleAttributeIdentifierMapping;
import org.hibernate.metamodel.model.domain.EntityDomainType;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.query.BindableType;
import org.hibernate.query.IllegalQueryOperationException;
@ -611,7 +610,7 @@ public class QuerySqmImpl<R>
final SqmInsertStatement<R> sqmInsert = (SqmInsertStatement<R>) getSqmStatement();
final String entityNameToInsert = sqmInsert.getTarget().getModel().getHibernateEntityName();
final AbstractEntityPersister persister = (AbstractEntityPersister)
final EntityPersister persister =
getSessionFactory().getMappingMetamodel().getEntityDescriptor( entityNameToInsert );
boolean useMultiTableInsert = persister.hasMultipleTables();

View File

@ -29,7 +29,6 @@ import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
import org.hibernate.metamodel.mapping.EntityMappingType;
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.query.SemanticException;
import org.hibernate.query.SortDirection;
@ -144,14 +143,8 @@ public class CteInsertHandler implements InsertHandler {
this.domainParameterXref = domainParameterXref;
}
public static CteTable createCteTable(
CteTable sqmCteTable,
List<CteColumn> sqmCteColumns,
SessionFactoryImplementor factory) {
return new CteTable(
sqmCteTable.getTableExpression(),
sqmCteColumns
);
public static CteTable createCteTable(CteTable sqmCteTable, List<CteColumn> sqmCteColumns) {
return new CteTable( sqmCteTable.getTableExpression(), sqmCteColumns );
}
public SqmInsertStatement<?> getSqmStatement() {
@ -327,11 +320,7 @@ public class CteInsertHandler implements InsertHandler {
targetPathCteColumns.add( rowNumberColumn );
}
final CteTable entityCteTable = createCteTable(
getCteTable(),
targetPathCteColumns,
factory
);
final CteTable entityCteTable = createCteTable( getCteTable(), targetPathCteColumns );
// Create the main query spec that will return the count of rows
final QuerySpec querySpec = new QuerySpec( true, 1 );
@ -502,11 +491,7 @@ public class CteInsertHandler implements InsertHandler {
}
else {
targetPathCteColumns.add( 0, getCteTable().getCteColumns().get( 0 ) );
finalEntityCteTable = createCteTable(
getCteTable(),
targetPathCteColumns,
factory
);
finalEntityCteTable = createCteTable( getCteTable(), targetPathCteColumns );
}
final List<CteColumn> cteColumns = finalEntityCteTable.getCteColumns();
for ( int i = 1; i < cteColumns.size(); i++ ) {
@ -545,11 +530,7 @@ public class CteInsertHandler implements InsertHandler {
);
statement.addCteStatement( baseEntityCte );
targetPathCteColumns.add( 0, cteTable.getCteColumns().get( 0 ) );
final CteTable finalEntityCteTable = createCteTable(
getCteTable(),
targetPathCteColumns,
factory
);
final CteTable finalEntityCteTable = createCteTable( getCteTable(), targetPathCteColumns );
final QuerySpec finalQuerySpec = new QuerySpec( true );
final SelectStatement finalQueryStatement = new SelectStatement( finalQuerySpec );
entityCte = new CteStatement(
@ -719,7 +700,7 @@ public class CteInsertHandler implements InsertHandler {
// Add the root insert as cte
final AbstractEntityPersister persister = (AbstractEntityPersister) entityDescriptor.getEntityPersister();
final EntityPersister persister = entityDescriptor.getEntityPersister();
final String rootTableName = persister.getTableName( 0 );
final TableReference rootTableReference = updatingTableGroup.getTableReference(
updatingTableGroup.getNavigablePath(),
@ -1093,9 +1074,8 @@ public class CteInsertHandler implements InsertHandler {
List<String> columnsToMatch;
if ( constraintColumnNames.isEmpty() ) {
// Assume the primary key columns
final AbstractEntityPersister aep = (AbstractEntityPersister) entityDescriptor;
Predicate predicate = buildColumnMatchPredicate(
columnsToMatch = Arrays.asList( aep.getKeyColumns( tableIndex ) ),
columnsToMatch = Arrays.asList( ( (EntityPersister) entityDescriptor).getKeyColumns( tableIndex ) ),
insertStatement,
false,
true

View File

@ -17,7 +17,6 @@ import org.hibernate.dialect.Dialect;
import org.hibernate.engine.spi.SessionFactoryImplementor;
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.query.SemanticException;
import org.hibernate.query.results.TableGroupImpl;
@ -80,7 +79,7 @@ public class CteUpdateHandler extends AbstractCteMutationHandler implements Upda
final SqmUpdateStatement<?> updateStatement = (SqmUpdateStatement<?>) getSqmDeleteOrUpdateStatement();
final EntityMappingType entityDescriptor = getEntityDescriptor();
final AbstractEntityPersister entityPersister = (AbstractEntityPersister) entityDescriptor.getEntityPersister();
final EntityPersister entityPersister = entityDescriptor.getEntityPersister();
final String rootEntityName = entityPersister.getRootEntityName();
final EntityPersister rootEntityDescriptor = factory.getRuntimeMetamodels()
.getMappingMetamodel()

View File

@ -23,7 +23,6 @@ import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping;
import org.hibernate.metamodel.mapping.MappingModelExpressible;
import org.hibernate.metamodel.mapping.SelectableConsumer;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.query.SemanticException;
import org.hibernate.query.spi.DomainQueryExecutionContext;
@ -268,7 +267,7 @@ public class InlineUpdateHandler implements UpdateHandler {
return;
}
// Otherwise we have to check if the table is nullable, and if so, insert into that table
final AbstractEntityPersister entityPersister = (AbstractEntityPersister) entityDescriptor.getEntityPersister();
final EntityPersister entityPersister = entityDescriptor.getEntityPersister();
boolean isNullable = false;
for (int i = 0; i < entityPersister.getTableSpan(); i++) {
if ( tableExpression.equals( entityPersister.getTableName( i ) ) && entityPersister.isNullableTable( i ) ) {

View File

@ -38,7 +38,6 @@ import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.MappingModelExpressible;
import org.hibernate.metamodel.mapping.ModelPartContainer;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.mutation.EntityMutationTarget;
import org.hibernate.query.SemanticException;
@ -218,7 +217,7 @@ public class InsertExecutionDelegate implements TableBasedInsertHandler.Executio
);
if ( rows != 0 ) {
final AbstractEntityPersister persister = (AbstractEntityPersister) entityDescriptor.getEntityPersister();
final EntityPersister persister = entityDescriptor.getEntityPersister();
final int tableSpan = persister.getTableSpan();
final int insertedRows = insertRootTable(
persister.getTableName( 0 ),
@ -726,7 +725,7 @@ public class InsertExecutionDelegate implements TableBasedInsertHandler.Executio
}
}
final String targetKeyColumnName = keyColumns[0];
final AbstractEntityPersister entityPersister = (AbstractEntityPersister) entityDescriptor.getEntityPersister();
final EntityPersister entityPersister = entityDescriptor.getEntityPersister();
final Generator identifierGenerator = entityPersister.getGenerator();
final boolean needsKeyInsert;
if ( identifierGenerator.generatedOnExecution() ) {

View File

@ -25,7 +25,7 @@ import org.hibernate.metamodel.mapping.MappingModelExpressible;
import org.hibernate.metamodel.mapping.ModelPartContainer;
import org.hibernate.metamodel.mapping.SelectableConsumer;
import org.hibernate.metamodel.mapping.SoftDeleteMapping;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.query.SemanticException;
import org.hibernate.query.results.TableGroupImpl;
import org.hibernate.query.spi.DomainQueryExecutionContext;
@ -299,7 +299,7 @@ public class UpdateExecutionDelegate implements TableBasedUpdateHandler.Executio
}
protected boolean isTableOptional(String tableExpression) {
final AbstractEntityPersister entityPersister = (AbstractEntityPersister) entityDescriptor.getEntityPersister();
final EntityPersister entityPersister = entityDescriptor.getEntityPersister();
for ( int i = 0; i < entityPersister.getTableSpan(); i++ ) {
if ( tableExpression.equals( entityPersister.getTableName( i ) )
&& entityPersister.isNullableTable( i ) ) {

View File

@ -108,7 +108,6 @@ import org.hibernate.metamodel.model.domain.internal.EmbeddedSqmPathSource;
import org.hibernate.metamodel.model.domain.internal.EntityDiscriminatorSqmPath;
import org.hibernate.metamodel.model.domain.internal.EntityTypeImpl;
import org.hibernate.metamodel.spi.MappingMetamodelImplementor;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityNameUse;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.query.BindableType;
@ -3073,7 +3072,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
EntityNameUse entityNameUse,
String treatTargetTypeName,
boolean projection) {
final AbstractEntityPersister persister;
final EntityPersister persister;
if ( tableGroup.getModelPart() instanceof EmbeddableValuedModelPart ) {
persister = null;
final EmbeddableDomainType<?> embeddableDomainType = creationContext.getSessionFactory()
@ -3085,11 +3084,10 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
}
}
else {
persister = (AbstractEntityPersister) creationContext.getSessionFactory()
.getRuntimeMetamodels()
persister = (EntityPersister) creationContext.getSessionFactory()
.getMappingMetamodel()
.findEntityDescriptor( treatTargetTypeName );
if ( persister == null || !persister.isPolymorphic() ) {
if ( persister == null || !persister.getEntityMetamodel().isPolymorphic() ) {
return;
}
}
@ -3140,10 +3138,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
EntityMappingType superMappingType = persister;
while ( ( superMappingType = superMappingType.getSuperMappingType() ) != null ) {
entityNameUses.putIfAbsent( superMappingType.getEntityName(), EntityNameUse.PROJECTION );
actualTableGroup.resolveTableReference(
null,
( (AbstractEntityPersister) superMappingType.getEntityPersister() ).getTableName()
);
actualTableGroup.resolveTableReference( null, superMappingType.getEntityPersister().getTableName() );
}
}
@ -3205,7 +3200,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
final MappingType partMappingType = tableGroup.getModelPart().getPartMappingType();
if ( partMappingType instanceof EntityMappingType ) {
final EntityMappingType mappingType = (EntityMappingType) partMappingType;
final AbstractEntityPersister persister = (AbstractEntityPersister) mappingType.getEntityPersister();
final EntityPersister persister = mappingType.getEntityPersister();
// Avoid resolving subclass tables for persisters with physical discriminators as we won't need them
if ( persister.getDiscriminatorMapping().hasPhysicalColumn() ) {
return;
@ -5234,7 +5229,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
final TableGroup elementTableGroup = tableGroup instanceof PluralTableGroup
? ( (PluralTableGroup) tableGroup ).getElementTableGroup()
: tableGroup;
final AbstractEntityPersister persister = (AbstractEntityPersister) elementTableGroup.getModelPart().getPartMappingType();
final EntityPersister persister = (EntityPersister) elementTableGroup.getModelPart().getPartMappingType();
// Only need a case expression around the basic valued path for the parent treat expression
// if the column of the basic valued path is shared between subclasses
if ( persister.isSharedColumn( basicPath.getColumnReference().getColumnExpression() ) ) {
@ -5434,8 +5429,8 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
}
private Predicate createTreatTypeRestriction(SqmPath<?> lhs, EntityDomainType<?> treatTarget) {
final AbstractEntityPersister entityDescriptor = (AbstractEntityPersister) domainModel.findEntityDescriptor( treatTarget.getHibernateEntityName() );
if ( entityDescriptor.isPolymorphic() && lhs.getNodeType() != treatTarget ) {
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor( treatTarget.getHibernateEntityName() );
if ( entityDescriptor.getEntityMetamodel().isPolymorphic() && lhs.getNodeType() != treatTarget ) {
final Set<String> subclassEntityNames = entityDescriptor.getSubclassEntityNames();
return createTreatTypeRestriction( lhs, subclassEntityNames );
}

View File

@ -57,7 +57,6 @@ import org.hibernate.metamodel.mapping.ModelPart;
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.EntityPersister;
import org.hibernate.persister.internal.SqlFragmentPredicate;
import org.hibernate.query.IllegalQueryOperationException;
@ -5974,8 +5973,8 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
processNestedTableGroupJoins( tableGroup, null );
processTableGroupJoins( tableGroup );
ModelPartContainer modelPart = tableGroup.getModelPart();
if ( modelPart instanceof AbstractEntityPersister ) {
String[] querySpaces = (String[]) ( (AbstractEntityPersister) modelPart ).getQuerySpaces();
if ( modelPart instanceof EntityPersister ) {
String[] querySpaces = (String[]) ( (EntityPersister) modelPart ).getQuerySpaces();
for ( int i = 0; i < querySpaces.length; i++ ) {
registerAffectedTable( querySpaces[i] );
}
@ -6017,8 +6016,8 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
processTableGroupJoins( tableGroup );
}
ModelPartContainer modelPart = tableGroup.getModelPart();
if ( modelPart instanceof AbstractEntityPersister ) {
String[] querySpaces = (String[]) ( (AbstractEntityPersister) modelPart ).getQuerySpaces();
if ( modelPart instanceof EntityPersister ) {
String[] querySpaces = (String[]) ( (EntityPersister) modelPart ).getQuerySpaces();
for ( int i = 0; i < querySpaces.length; i++ ) {
registerAffectedTable( querySpaces[i] );
}
@ -6100,8 +6099,8 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
}
ModelPartContainer modelPart = tableGroup.getModelPart();
if ( modelPart instanceof AbstractEntityPersister ) {
String[] querySpaces = (String[]) ( (AbstractEntityPersister) modelPart ).getQuerySpaces();
if ( modelPart instanceof EntityPersister ) {
String[] querySpaces = (String[]) ( (EntityPersister) modelPart ).getQuerySpaces();
for ( int i = 0; i < querySpaces.length; i++ ) {
registerAffectedTable( querySpaces[i] );
}

View File

@ -14,7 +14,7 @@ import java.util.function.Consumer;
import org.hibernate.metamodel.mapping.SelectableConsumer;
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.mutation.EntityMutationTarget;
import org.hibernate.sql.model.MutationType;
import org.hibernate.sql.model.ast.MutationGroup;
@ -73,8 +73,7 @@ public class MutationGroupBuilder implements SelectableConsumer {
@Override
public void accept(int selectionIndex, SelectableMapping selectableMapping) {
final AbstractEntityPersister entityPersister = (AbstractEntityPersister) mutationTarget.getTargetPart()
.getEntityPersister();
final EntityPersister entityPersister = mutationTarget.getTargetPart().getEntityPersister();
final String tableNameForMutation = entityPersister.physicalTableNameForMutation( selectableMapping );
final ColumnValuesTableMutationBuilder mutationBuilder = findTableDetailsBuilder( tableNameForMutation );
mutationBuilder.addValueColumn( selectableMapping );

View File

@ -15,7 +15,6 @@ 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;
@ -56,6 +55,7 @@ import org.hibernate.metamodel.mapping.EntityVersionMapping;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.NaturalIdMapping;
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.metamodel.mapping.TableDetails;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.metamodel.spi.EntityRepresentationStrategy;
@ -76,6 +76,7 @@ import org.hibernate.sql.ast.spi.SqlAstCreationState;
import org.hibernate.sql.ast.spi.SqlSelection;
import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.ast.tree.predicate.Predicate;
import org.hibernate.sql.model.ast.builder.MutationGroupBuilder;
import org.hibernate.sql.results.graph.DomainResult;
import org.hibernate.sql.results.graph.DomainResultCreationState;
import org.hibernate.tuple.entity.EntityMetamodel;
@ -919,16 +920,6 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
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];
@ -948,6 +939,111 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
public String[] toColumns(String propertyName) {
return new String[0];
}
@Override
public boolean[] getNonLazyPropertyUpdateability() {
return new boolean[0];
}
@Override
public boolean hasMultipleTables() {
return false;
}
@Override
public String[] getTableNames() {
return new String[0];
}
@Override
public String getTableName(int j) {
return "";
}
@Override
public String[] getKeyColumns(int j) {
return new String[0];
}
@Override
public int getTableSpan() {
return 0;
}
@Override
public boolean isInverseTable(int j) {
return false;
}
@Override
public boolean isNullableTable(int j) {
return false;
}
@Override
public boolean hasDuplicateTables() {
return false;
}
@Override
public int getSubclassTableSpan() {
return 0;
}
@Override
public String getSubclassTableName(int j) {
return "";
}
@Override
public String getTableNameForColumn(String columnName) {
return "";
}
@Override
public String[] getSubclassPropertyColumnNames(int i) {
return new String[0];
}
@Override
public int countSubclassProperties() {
return 0;
}
@Override
public boolean isSharedColumn(String columnExpression) {
return false;
}
@Override
public String[][] getConstraintOrderedTableKeyColumnClosure() {
return new String[0][];
}
@Override
public EntityTableMapping[] getTableMappings() {
return new EntityTableMapping[0];
}
@Override
public String physicalTableNameForMutation(SelectableMapping selectableMapping) {
return "";
}
@Override
public void addDiscriminatorToInsertGroup(MutationGroupBuilder insertGroupBuilder) {
}
@Override
public void addSoftDeleteToInsertGroup(MutationGroupBuilder insertGroupBuilder) {
}
@Override
public String getAttributeMutationTableName(int i) {
return "";
}
}
public static class NoopCollectionPersister implements CollectionPersister {

View File

@ -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.EntityPersister;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.type.AssociationType;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -172,17 +172,15 @@ public class BatchFetchStrategyHelperTest extends BaseCoreFunctionalTestCase {
}
private org.hibernate.FetchMode determineFetchMode(Class<?> entityClass, String path) {
EntityPersister entityPersister = sessionFactory().getRuntimeMetamodels()
.getMappingMetamodel()
.getEntityDescriptor(entityClass.getName());
AbstractEntityPersister entityPersister = (AbstractEntityPersister)
sessionFactory().getMappingMetamodel().getEntityDescriptor(entityClass.getName());
int index = entityPersister.getPropertyIndex( path );
return entityPersister.getFetchMode( index );
}
private AssociationType determineAssociationType(Class<?> entityClass, String path) {
EntityPersister entityPersister = sessionFactory().getRuntimeMetamodels()
.getMappingMetamodel()
.getEntityDescriptor(entityClass.getName());
AbstractEntityPersister entityPersister = (AbstractEntityPersister)
sessionFactory().getMappingMetamodel().getEntityDescriptor(entityClass.getName());
int index = entityPersister.getPropertyIndex( path );
return (AssociationType) entityPersister.getSubclassPropertyType( index );
}

View File

@ -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.EntityPersister;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.type.AssociationType;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -168,17 +168,15 @@ public class FetchStrategyHelperTest extends BaseCoreFunctionalTestCase {
}
private org.hibernate.FetchMode determineFetchMode(Class<?> entityClass, String path) {
EntityPersister entityPersister = sessionFactory().getRuntimeMetamodels()
.getMappingMetamodel()
.getEntityDescriptor(entityClass.getName());
AbstractEntityPersister entityPersister = (AbstractEntityPersister)
sessionFactory().getMappingMetamodel().getEntityDescriptor(entityClass.getName());
int index = entityPersister.getPropertyIndex( path );
return entityPersister.getFetchMode( index );
}
private AssociationType determineAssociationType(Class<?> entityClass, String path) {
EntityPersister entityPersister = sessionFactory().getRuntimeMetamodels()
.getMappingMetamodel()
.getEntityDescriptor(entityClass.getName());
AbstractEntityPersister entityPersister = (AbstractEntityPersister)
sessionFactory().getMappingMetamodel().getEntityDescriptor(entityClass.getName());
int index = entityPersister.getPropertyIndex( path );
return (AssociationType) entityPersister.getSubclassPropertyType( index );
}

View File

@ -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.EntityPersister;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.type.AssociationType;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -89,17 +89,15 @@ public class NoProxyFetchStrategyHelperTest extends BaseCoreFunctionalTestCase {
}
private org.hibernate.FetchMode determineFetchMode(Class<?> entityClass, String path) {
EntityPersister entityPersister = sessionFactory().getRuntimeMetamodels()
.getMappingMetamodel()
.getEntityDescriptor(entityClass.getName());
AbstractEntityPersister entityPersister = (AbstractEntityPersister)
sessionFactory().getMappingMetamodel().getEntityDescriptor(entityClass.getName());
int index = entityPersister.getPropertyIndex( path );
return entityPersister.getFetchMode( index );
}
private AssociationType determineAssociationType(Class<?> entityClass, String path) {
EntityPersister entityPersister = sessionFactory().getRuntimeMetamodels()
.getMappingMetamodel()
.getEntityDescriptor(entityClass.getName());
AbstractEntityPersister entityPersister = (AbstractEntityPersister)
sessionFactory().getMappingMetamodel().getEntityDescriptor(entityClass.getName());
int index = entityPersister.getPropertyIndex( path );
return (AssociationType) entityPersister.getSubclassPropertyType( index );
}

View File

@ -15,7 +15,6 @@ 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;
@ -54,6 +53,7 @@ import org.hibernate.metamodel.mapping.EntityVersionMapping;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.NaturalIdMapping;
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.metamodel.mapping.TableDetails;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.metamodel.spi.EntityRepresentationStrategy;
@ -74,6 +74,7 @@ import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
import org.hibernate.spi.NavigablePath;
import org.hibernate.sql.ast.spi.SqlSelection;
import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.model.ast.builder.MutationGroupBuilder;
import org.hibernate.sql.results.graph.DomainResult;
import org.hibernate.sql.results.graph.DomainResultCreationState;
import org.hibernate.tuple.entity.EntityMetamodel;
@ -950,16 +951,6 @@ public class PersisterClassProviderTest {
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];
@ -979,6 +970,111 @@ public class PersisterClassProviderTest {
public String[] toColumns(String propertyName) {
return new String[0];
}
@Override
public boolean[] getNonLazyPropertyUpdateability() {
return new boolean[0];
}
@Override
public boolean hasMultipleTables() {
return false;
}
@Override
public String[] getTableNames() {
return new String[0];
}
@Override
public String getTableName(int j) {
return "";
}
@Override
public String[] getKeyColumns(int j) {
return new String[0];
}
@Override
public int getTableSpan() {
return 0;
}
@Override
public boolean isInverseTable(int j) {
return false;
}
@Override
public boolean isNullableTable(int j) {
return false;
}
@Override
public boolean hasDuplicateTables() {
return false;
}
@Override
public int getSubclassTableSpan() {
return 0;
}
@Override
public String getSubclassTableName(int j) {
return "";
}
@Override
public String getTableNameForColumn(String columnName) {
return "";
}
@Override
public String[] getSubclassPropertyColumnNames(int i) {
return new String[0];
}
@Override
public int countSubclassProperties() {
return 0;
}
@Override
public boolean isSharedColumn(String columnExpression) {
return false;
}
@Override
public String[][] getConstraintOrderedTableKeyColumnClosure() {
return new String[0][];
}
@Override
public EntityTableMapping[] getTableMappings() {
return new EntityTableMapping[0];
}
@Override
public String physicalTableNameForMutation(SelectableMapping selectableMapping) {
return "";
}
@Override
public void addDiscriminatorToInsertGroup(MutationGroupBuilder insertGroupBuilder) {
}
@Override
public void addSoftDeleteToInsertGroup(MutationGroupBuilder insertGroupBuilder) {
}
@Override
public String getAttributeMutationTableName(int i) {
return "";
}
}
public static class GoofyException extends RuntimeException {

View File

@ -15,7 +15,6 @@ 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;
@ -55,6 +54,7 @@ import org.hibernate.metamodel.mapping.EntityVersionMapping;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.NaturalIdMapping;
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.metamodel.mapping.TableDetails;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.metamodel.spi.EntityRepresentationStrategy;
@ -72,6 +72,7 @@ import org.hibernate.spi.NavigablePath;
import org.hibernate.sql.ast.spi.SqlSelection;
import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.model.MutationOperationGroup;
import org.hibernate.sql.model.ast.builder.MutationGroupBuilder;
import org.hibernate.sql.results.graph.DomainResult;
import org.hibernate.sql.results.graph.DomainResultCreationState;
import org.hibernate.tuple.entity.EntityMetamodel;
@ -1058,16 +1059,6 @@ public class CustomPersister implements EntityPersister {
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];
@ -1087,4 +1078,109 @@ public class CustomPersister implements EntityPersister {
public String[] toColumns(String propertyName) {
return new String[0];
}
@Override
public boolean[] getNonLazyPropertyUpdateability() {
return new boolean[0];
}
@Override
public boolean hasMultipleTables() {
return false;
}
@Override
public String[] getTableNames() {
return new String[0];
}
@Override
public String getTableName(int j) {
return "";
}
@Override
public String[] getKeyColumns(int j) {
return new String[0];
}
@Override
public int getTableSpan() {
return 0;
}
@Override
public boolean isInverseTable(int j) {
return false;
}
@Override
public boolean isNullableTable(int j) {
return false;
}
@Override
public boolean hasDuplicateTables() {
return false;
}
@Override
public int getSubclassTableSpan() {
return 0;
}
@Override
public String getSubclassTableName(int j) {
return "";
}
@Override
public String getTableNameForColumn(String columnName) {
return "";
}
@Override
public String[] getSubclassPropertyColumnNames(int i) {
return new String[0];
}
@Override
public int countSubclassProperties() {
return 0;
}
@Override
public boolean isSharedColumn(String columnExpression) {
return false;
}
@Override
public String[][] getConstraintOrderedTableKeyColumnClosure() {
return new String[0][];
}
@Override
public EntityTableMapping[] getTableMappings() {
return new EntityTableMapping[0];
}
@Override
public String physicalTableNameForMutation(SelectableMapping selectableMapping) {
return "";
}
@Override
public void addDiscriminatorToInsertGroup(MutationGroupBuilder insertGroupBuilder) {
}
@Override
public void addSoftDeleteToInsertGroup(MutationGroupBuilder insertGroupBuilder) {
}
@Override
public String getAttributeMutationTableName(int i) {
return "";
}
}

View File

@ -12,8 +12,8 @@ import jakarta.persistence.MapsId;
import jakarta.persistence.OneToOne;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.mutation.UpdateCoordinatorStandard;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.logger.LoggerInspectionRule;
import org.hibernate.testing.logger.Triggerable;
@ -43,7 +43,7 @@ public class OneToOneMapsIdChangeParentTest {
public LoggerInspectionRule logInspection = new LoggerInspectionRule(
Logger.getMessageLogger(
CoreMessageLogger.class,
AbstractEntityPersister.class.getName()
UpdateCoordinatorStandard.class.getName()
)
);