HHH-16030 Improve name for method EntityInitializer#isInitialized and avoid providing a default implementation

This commit is contained in:
Sanne Grinovero 2023-01-12 11:34:04 +00:00 committed by Sanne Grinovero
parent 146f7fc234
commit b037047e24
8 changed files with 28 additions and 9 deletions

View File

@ -32,7 +32,7 @@ public class DelayedCollectionInitializer extends AbstractCollectionInitializer
public void resolveInstance(RowProcessingState rowProcessingState) {
if ( parentAccess != null ) {
final EntityInitializer parentEntityInitializer = parentAccess.findFirstEntityInitializer();
if ( parentEntityInitializer != null && parentEntityInitializer.isInitialized() ) {
if ( parentEntityInitializer != null && parentEntityInitializer.isEntityInitialized() ) {
return;
}
}

View File

@ -984,7 +984,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
}
@Override
public boolean isInitialized() {
public boolean isEntityInitialized() {
return isInitialized;
}

View File

@ -60,8 +60,9 @@ public interface EntityInitializer extends FetchParentAccess {
return this;
}
default boolean isInitialized() {
return false;
}
/**
* @return true if the current entity associated to this EntityInitializer has been initialized
*/
boolean isEntityInitialized();
}

View File

@ -94,6 +94,11 @@ public class BatchEntityInsideEmbeddableSelectFetchInitializer extends AbstractB
return objects;
}
@Override
public boolean isEntityInitialized() {
return false;
}
private static class ParentInfo {
private final EntityKey initializerEntityKey;
private final Object parentInstance;

View File

@ -58,6 +58,11 @@ public class BatchEntitySelectFetchInitializer extends AbstractBatchEntitySelect
return objects;
}
@Override
public boolean isEntityInitialized() {
return false;
}
private static class ParentInfo {
private final Object parentInstance;
private final int propertyIndex;

View File

@ -24,8 +24,6 @@ import org.hibernate.spi.NavigablePath;
import org.hibernate.sql.results.graph.AbstractFetchParentAccess;
import org.hibernate.sql.results.graph.DomainResultAssembler;
import org.hibernate.sql.results.graph.FetchParentAccess;
import org.hibernate.sql.results.graph.embeddable.EmbeddableInitializer;
import org.hibernate.sql.results.graph.entity.AbstractEntityInitializer;
import org.hibernate.sql.results.graph.entity.EntityInitializer;
import org.hibernate.sql.results.graph.entity.LoadingEntityEntry;
import org.hibernate.sql.results.jdbc.spi.RowProcessingState;
@ -84,7 +82,7 @@ public class EntityDelayedFetchInitializer extends AbstractFetchParentAccess imp
}
final EntityInitializer parentEntityInitializer = getParentEntityInitializer( parentAccess );
if ( parentEntityInitializer != null && parentEntityInitializer.isInitialized() ) {
if ( parentEntityInitializer != null && parentEntityInitializer.isEntityInitialized() ) {
return;
}
@ -226,6 +224,11 @@ public class EntityDelayedFetchInitializer extends AbstractFetchParentAccess imp
throw new UnsupportedOperationException();
}
@Override
public boolean isEntityInitialized() {
return false;
}
@Override
public Object getParentKey() {
throw new UnsupportedOperationException();

View File

@ -46,7 +46,7 @@ public class EntitySelectFetchByUniqueKeyInitializer extends EntitySelectFetchIn
if ( parentEntityInitializer != null && parentEntityInitializer.getEntityKey() != null ) {
// make sure parentEntityInitializer.resolveInstance has been called before
parentEntityInitializer.resolveInstance( rowProcessingState );
if ( parentEntityInitializer.isInitialized() ) {
if ( parentEntityInitializer.isEntityInitialized() ) {
isInitialized = true;
return;
}

View File

@ -232,6 +232,11 @@ public class EntitySelectFetchInitializer extends AbstractFetchParentAccess impl
throw new UnsupportedOperationException();
}
@Override
public boolean isEntityInitialized() {
return isInitialized;
}
@Override
public Object getParentKey() {
return parentAccess.getParentKey();