Skip to content

Commit

Permalink
clean up some obsolete code in AbstractEntityPersister
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Sep 17, 2024
1 parent d81b284 commit e9bf523
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
import org.hibernate.MappingException;
import org.hibernate.PropertyValueException;
import org.hibernate.QueryException;
import org.hibernate.StaleObjectStateException;
import org.hibernate.StaleStateException;
import org.hibernate.annotations.CacheLayout;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.model.internal.SoftDeleteHelper;
Expand Down Expand Up @@ -120,7 +118,6 @@
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.internal.util.collections.LockModeEnumMap;
import org.hibernate.jdbc.Expectation;
import org.hibernate.jdbc.TooManyRowsAffectedException;
import org.hibernate.loader.ast.internal.CacheEntityLoaderHelper;
import org.hibernate.loader.ast.internal.LoaderSelectBuilder;
import org.hibernate.loader.ast.internal.LoaderSqlAstCreationState;
Expand Down Expand Up @@ -270,7 +267,6 @@
import org.hibernate.sql.results.graph.entity.internal.EntityResultImpl;
import org.hibernate.sql.results.graph.internal.ImmutableFetchList;
import org.hibernate.sql.results.internal.SqlSelectionImpl;
import org.hibernate.stat.spi.StatisticsImplementor;
import org.hibernate.tuple.NonIdentifierAttribute;
import org.hibernate.tuple.entity.EntityMetamodel;
import org.hibernate.type.AnyType;
Expand Down Expand Up @@ -2620,42 +2616,6 @@ protected void initPropertyPaths(Metadata mapping) throws MappingException {
}
}

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
public String getIdentitySelectString() {
return identitySelectString;
Expand Down Expand Up @@ -2757,28 +2717,6 @@ public ModelPart getIdentifierDescriptor() {
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() {
if ( LOG.isDebugEnabled() ) {
LOG.debugf( "Static SQL for entity: %s", getEntityName() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,12 +696,6 @@ protected boolean isIdentifierTable(String tableExpression) {
return tableExpression.equals( getRootTableName() );
}

@Override
public boolean hasSkippableTables() {
// todo (6.x) : cache this?
return hasAnySkippableTables( isNullableTable, isInverseTable );
}

@Override
public boolean isInverseTable(int j) {
return isInverseTable[j];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,6 @@ protected boolean isIdentifierTable(String tableExpression) {
return tableExpression.equals( getRootTableName() );
}

@Override
public boolean hasSkippableTables() {
// todo (6.x) : cache this?
return hasAnySkippableTables( isNullableTable, isInverseTable );
}

@Override
protected boolean isNullableSubclassTable(int j) {
return isNullableSubclassTable[j];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,6 @@ public interface EntityMutationTarget extends MutationTarget<EntityTableMapping>
*/
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
* targets defined using post-insert id generation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -848,11 +848,6 @@ public ModelPart getIdentifierDescriptor() {
return null;
}

@Override
public boolean hasSkippableTables() {
return false;
}

@Override
public GeneratedValuesMutationDelegate getInsertDelegate() {
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/*
* 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
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.orm.test.inheritance;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -879,11 +879,6 @@ public ModelPart getIdentifierDescriptor() {
return null;
}

@Override
public boolean hasSkippableTables() {
return false;
}

@Override
public GeneratedValuesMutationDelegate getInsertDelegate() {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -987,11 +987,6 @@ public ModelPart getIdentifierDescriptor() {
return null;
}

@Override
public boolean hasSkippableTables() {
return false;
}

@Override
public GeneratedValuesMutationDelegate getInsertDelegate() {
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

import org.hibernate.annotations.Imported;
Expand Down

0 comments on commit e9bf523

Please sign in to comment.