Code refactoring

This commit is contained in:
Andrea Boriero 2021-11-04 19:42:39 +01:00
parent 0b46966096
commit b70487546e
5 changed files with 3 additions and 31 deletions

View File

@ -53,13 +53,9 @@ public class FetchingScrollableResultsImpl<R> extends AbstractScrollableResults<
}
private static <R> EntityInitializer extractResultInitializer(RowReader<R> rowReader) {
for ( Initializer initializer : rowReader.getInitializers() ) {
if ( initializer instanceof EntityInitializer ) {
EntityInitializer entityInitializer = (EntityInitializer) initializer;
if ( entityInitializer instanceof EntityResultInitializer ) {
return entityInitializer;
}
}
Initializer initializer = rowReader.getInitializers().get( rowReader.getInitializers().size() - 1 );
if ( initializer instanceof EntityInitializer ) {
return (EntityInitializer) initializer;
}
return null;
}
@ -123,9 +119,6 @@ public class FetchingScrollableResultsImpl<R> extends AbstractScrollableResults<
// In the latter scenario, the previous logical row
// really is the last logical row.
//
// In all other cases, we should process back two
// logical records (the current logic row, plus the
// previous logical row).
if ( getRowProcessingState().isAfterLast() && maxPosition != null && currentPosition > maxPosition ) {
// position cursor to the last row
getRowProcessingState().last();
@ -138,7 +131,6 @@ public class FetchingScrollableResultsImpl<R> extends AbstractScrollableResults<
// in skipping
getRowProcessingState().previous();
// getRowProcessingState().previous();
// sequentially read the result set in reverse until we recognize
// a change in the key value. At that point, we are pointed at
@ -324,8 +316,6 @@ public class FetchingScrollableResultsImpl<R> extends AbstractScrollableResults<
currentRow = rowReader.readRow( getRowProcessingState(), getProcessingOptions() );
// currentRow = new Object[] {row};
getRowProcessingState().finishRowProcessing();
while ( !resultProcessed ) {

View File

@ -605,11 +605,6 @@ public class CompoundNaturalIdMapping extends AbstractNaturalIdMapping implement
return navigablePath;
}
@Override
public EntityKey getEntityKey() {
return null;
}
@Override
public ModelPart getInitializedPart() {
return naturalIdMapping;

View File

@ -27,8 +27,6 @@ public interface FetchParentAccess extends Initializer {
NavigablePath getNavigablePath();
EntityKey getEntityKey();
/**
* Register a listener to be notified when the parent is "resolved"
*

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.sql.results.graph.embeddable.internal;
import org.hibernate.engine.spi.EntityKey;
import org.hibernate.sql.results.graph.AssemblerCreationState;
import org.hibernate.sql.results.graph.FetchParentAccess;
import org.hibernate.sql.results.graph.embeddable.AbstractEmbeddableInitializer;
@ -29,8 +28,4 @@ public class EmbeddableFetchInitializer
return findFirstEntityDescriptorAccess().getParentKey();
}
@Override
public EntityKey getEntityKey() {
return findFirstEntityDescriptorAccess().getEntityKey();
}
}

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.sql.results.graph.embeddable.internal;
import org.hibernate.engine.spi.EntityKey;
import org.hibernate.sql.results.graph.AssemblerCreationState;
import org.hibernate.sql.results.graph.embeddable.AbstractEmbeddableInitializer;
import org.hibernate.sql.results.graph.embeddable.EmbeddableResultGraphNode;
@ -26,11 +25,6 @@ public class EmbeddableResultInitializer extends AbstractEmbeddableInitializer {
return findFirstEntityDescriptorAccess().getParentKey();
}
@Override
public EntityKey getEntityKey() {
return findFirstEntityDescriptorAccess().getEntityKey();
}
@Override
public String toString() {
return "EmbeddableResultInitializer(" + getNavigablePath() + ")";