clean up some obsolete code in AbstractEntityPersister

This commit is contained in:
Gavin King 2024-09-17 10:37:21 +02:00
parent d81b2842b7
commit e9bf523ce1
9 changed files with 6 additions and 107 deletions

View File

@ -40,8 +40,6 @@ import org.hibernate.LockOptions;
import org.hibernate.MappingException; import org.hibernate.MappingException;
import org.hibernate.PropertyValueException; import org.hibernate.PropertyValueException;
import org.hibernate.QueryException; import org.hibernate.QueryException;
import org.hibernate.StaleObjectStateException;
import org.hibernate.StaleStateException;
import org.hibernate.annotations.CacheLayout; import org.hibernate.annotations.CacheLayout;
import org.hibernate.boot.Metadata; import org.hibernate.boot.Metadata;
import org.hibernate.boot.model.internal.SoftDeleteHelper; import org.hibernate.boot.model.internal.SoftDeleteHelper;
@ -120,7 +118,6 @@ import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.internal.util.collections.LockModeEnumMap; import org.hibernate.internal.util.collections.LockModeEnumMap;
import org.hibernate.jdbc.Expectation; import org.hibernate.jdbc.Expectation;
import org.hibernate.jdbc.TooManyRowsAffectedException;
import org.hibernate.loader.ast.internal.CacheEntityLoaderHelper; import org.hibernate.loader.ast.internal.CacheEntityLoaderHelper;
import org.hibernate.loader.ast.internal.LoaderSelectBuilder; import org.hibernate.loader.ast.internal.LoaderSelectBuilder;
import org.hibernate.loader.ast.internal.LoaderSqlAstCreationState; import org.hibernate.loader.ast.internal.LoaderSqlAstCreationState;
@ -270,7 +267,6 @@ import org.hibernate.sql.results.graph.FetchableContainer;
import org.hibernate.sql.results.graph.entity.internal.EntityResultImpl; import org.hibernate.sql.results.graph.entity.internal.EntityResultImpl;
import org.hibernate.sql.results.graph.internal.ImmutableFetchList; import org.hibernate.sql.results.graph.internal.ImmutableFetchList;
import org.hibernate.sql.results.internal.SqlSelectionImpl; import org.hibernate.sql.results.internal.SqlSelectionImpl;
import org.hibernate.stat.spi.StatisticsImplementor;
import org.hibernate.tuple.NonIdentifierAttribute; import org.hibernate.tuple.NonIdentifierAttribute;
import org.hibernate.tuple.entity.EntityMetamodel; import org.hibernate.tuple.entity.EntityMetamodel;
import org.hibernate.type.AnyType; import org.hibernate.type.AnyType;
@ -2620,42 +2616,6 @@ public abstract class AbstractEntityPersister
} }
} }
protected boolean check(
int rows,
Object id,
int tableNumber,
Expectation expectation,
PreparedStatement statement,
String statementSQL) throws HibernateException {
try {
expectation.verifyOutcome( rows, statement, -1, statementSQL );
}
catch ( StaleStateException e ) {
if ( !isNullableTable( tableNumber ) ) {
final StatisticsImplementor statistics = getFactory().getStatistics();
if ( statistics.isStatisticsEnabled() ) {
statistics.optimisticFailure( getEntityName() );
}
throw new StaleObjectStateException( getEntityName(), id, e );
}
return false;
}
catch ( TooManyRowsAffectedException e ) {
throw new HibernateException(
"Duplicate identifier in table for: " +
infoString( this, id, getFactory() )
);
}
catch ( Throwable t ) {
return false;
}
return true;
}
public final boolean checkVersion(final boolean[] includeProperty) {
return includeProperty[getVersionProperty()] || isVersionGeneratedOnExecution();
}
@Override @Override
public String getIdentitySelectString() { public String getIdentitySelectString() {
return identitySelectString; return identitySelectString;
@ -2757,28 +2717,6 @@ public abstract class AbstractEntityPersister
return identifierMapping; return identifierMapping;
} }
@Override
public boolean hasSkippableTables() {
return false;
}
protected boolean hasAnySkippableTables(boolean[] optionalTables, boolean[] inverseTables) {
// todo (6.x) : cache this?
for ( int i = 0; i < optionalTables.length; i++ ) {
if ( optionalTables[i] ) {
return true;
}
}
for ( int i = 0; i < inverseTables.length; i++ ) {
if ( inverseTables[i] ) {
return true;
}
}
return false;
}
protected void logStaticSQL() { protected void logStaticSQL() {
if ( LOG.isDebugEnabled() ) { if ( LOG.isDebugEnabled() ) {
LOG.debugf( "Static SQL for entity: %s", getEntityName() ); LOG.debugf( "Static SQL for entity: %s", getEntityName() );

View File

@ -696,12 +696,6 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
return tableExpression.equals( getRootTableName() ); return tableExpression.equals( getRootTableName() );
} }
@Override
public boolean hasSkippableTables() {
// todo (6.x) : cache this?
return hasAnySkippableTables( isNullableTable, isInverseTable );
}
@Override @Override
public boolean isInverseTable(int j) { public boolean isInverseTable(int j) {
return isInverseTable[j]; return isInverseTable[j];

View File

@ -535,12 +535,6 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
return tableExpression.equals( getRootTableName() ); return tableExpression.equals( getRootTableName() );
} }
@Override
public boolean hasSkippableTables() {
// todo (6.x) : cache this?
return hasAnySkippableTables( isNullableTable, isInverseTable );
}
@Override @Override
protected boolean isNullableSubclassTable(int j) { protected boolean isNullableSubclassTable(int j) {
return isNullableSubclassTable[j]; return isNullableSubclassTable[j];

View File

@ -50,20 +50,6 @@ public interface EntityMutationTarget extends MutationTarget<EntityTableMapping>
*/ */
String getAttributeMutationTableName(int i); String getAttributeMutationTableName(int i);
/**
* Whether this target defines any potentially skippable tables.
* <p>
* A table is considered potentially skippable if it is defined
* as inverse or as optional.
*
* @see org.hibernate.annotations.SecondaryRow#owned
* @see org.hibernate.annotations.SecondaryRow#optional
*
* @deprecated No longer called
*/
@Deprecated(since = "7.0", forRemoval = true)
boolean hasSkippableTables();
/** /**
* The delegate for executing inserts against the root table for * The delegate for executing inserts against the root table for
* targets defined using post-insert id generation * targets defined using post-insert id generation

View File

@ -848,11 +848,6 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
return null; return null;
} }
@Override
public boolean hasSkippableTables() {
return false;
}
@Override @Override
public GeneratedValuesMutationDelegate getInsertDelegate() { public GeneratedValuesMutationDelegate getInsertDelegate() {
return null; return null;

View File

@ -1,8 +1,6 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * SPDX-License-Identifier: LGPL-2.1-or-later
* * Copyright Red Hat Inc. and Hibernate Authors
* 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.orm.test.inheritance; package org.hibernate.orm.test.inheritance;

View File

@ -879,11 +879,6 @@ public class PersisterClassProviderTest {
return null; return null;
} }
@Override
public boolean hasSkippableTables() {
return false;
}
@Override @Override
public GeneratedValuesMutationDelegate getInsertDelegate() { public GeneratedValuesMutationDelegate getInsertDelegate() {
return null; return null;

View File

@ -987,11 +987,6 @@ public class CustomPersister implements EntityPersister {
return null; return null;
} }
@Override
public boolean hasSkippableTables() {
return false;
}
@Override @Override
public GeneratedValuesMutationDelegate getInsertDelegate() { public GeneratedValuesMutationDelegate getInsertDelegate() {
return null; return null;

View File

@ -1,3 +1,7 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.orm.test.query.hql.instantiation; package org.hibernate.orm.test.query.hql.instantiation;
import org.hibernate.annotations.Imported; import org.hibernate.annotations.Imported;