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

View File

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

View File

@ -27,8 +27,6 @@ public interface FetchParentAccess extends Initializer {
NavigablePath getNavigablePath(); NavigablePath getNavigablePath();
EntityKey getEntityKey();
/** /**
* Register a listener to be notified when the parent is "resolved" * 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; 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.AssemblerCreationState;
import org.hibernate.sql.results.graph.FetchParentAccess; import org.hibernate.sql.results.graph.FetchParentAccess;
import org.hibernate.sql.results.graph.embeddable.AbstractEmbeddableInitializer; import org.hibernate.sql.results.graph.embeddable.AbstractEmbeddableInitializer;
@ -29,8 +28,4 @@ public class EmbeddableFetchInitializer
return findFirstEntityDescriptorAccess().getParentKey(); return findFirstEntityDescriptorAccess().getParentKey();
} }
@Override
public EntityKey getEntityKey() {
return findFirstEntityDescriptorAccess().getEntityKey();
}
} }

View File

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