Top Fields Constructors Methods
org.hibernate.loader.plan.build.internal

public Class LoadPlanImpl

extends Object
implements LoadPlan
Class Inheritance
All Implemented Interfaces
org.hibernate.loader.plan.spi.LoadPlan
Imports
java.util.Collections, .List, org.hibernate.loader.plan.spi.CollectionReturn, .EntityReturn, .LoadPlan, .QuerySpaces, .Return

Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private final boolean
private final LoadPlan.Disposition
private final QuerySpaces
private final List<? extends Return>

Constructor Summary

AccessConstructor and Description
protected
LoadPlanImpl(List<? extends Return> returns, QuerySpaces querySpaces, LoadPlan.Disposition disposition, boolean areLazyAttributesForceFetched)

public
LoadPlanImpl(EntityReturn
The EntityReturn representation of the entity being loaded.
rootReturn
,
QuerySpaces
The QuerySpaces containing all the query space references required for rootReturn and joined entity, collection, and composite references.
querySpaces
)

Creates a Disposition#ENTITY_LOADER LoadPlan.

public
LoadPlanImpl(CollectionReturn
The CollectionReturn representation of the collection being initialized.
rootReturn
,
QuerySpaces
The QuerySpaces containing all the query space references required for rootReturn and joined entity, collection, and composite references.
querySpaces
)

Creates a Disposition#COLLECTION_INITIALIZER LoadPlan.

public
LoadPlanImpl(List<? extends Return>
The mixed Return references
returns
,
QuerySpaces
The QuerySpaces containing all the query space references required for rootReturn and joined entity, collection, and composite references.
querySpaces
,
boolean
Should lazy attributes (bytecode enhanced laziness) be fetched also? This effects the eventual SQL SELECT-clause which is why we have it here. Currently this is "all-or-none"; you can request that all lazy properties across all entities in the loadplan be force fetched or none. There is no entity-by-entity option. FETCH ALL PROPERTIES is the way this is requested in HQL. Would be nice to consider this entity-by-entity, as opposed to all-or-none. For example, "fetch the LOB value for the Item.image attribute, but no others (leave them lazy)". Not too concerned about having it at the attribute level.
areLazyAttributesForceFetched
)

Creates a Disposition#MIXED LoadPlan.

Method Summary

Modifier and TypeMethod and Description
public boolean
areLazyAttributesForceFetched()

Implements org.hibernate.loader.plan.spi.LoadPlan.areLazyAttributesForceFetched.

Does this load plan indicate that lazy attributes are to be force fetched?
public LoadPlan.Disposition
getDisposition()

Implements org.hibernate.loader.plan.spi.LoadPlan.getDisposition.

What is the disposition of this LoadPlan, in terms of its returns.
public QuerySpaces
getQuerySpaces()

Implements org.hibernate.loader.plan.spi.LoadPlan.getQuerySpaces.

Gets the QuerySpaces for the load plan, which contains a QuerySpace reference for each non-scalar return and for each entity, collection, and composite FetchSource.
public List<? extends Return>
getReturns()

Implements org.hibernate.loader.plan.spi.LoadPlan.getReturns.

Get the returns indicated by this LoadPlan.
public boolean
hasAnyScalarReturns()

Implements org.hibernate.loader.plan.spi.LoadPlan.hasAnyScalarReturns.

Convenient form of checking getReturns() for scalar root returns.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

areLazyAttributesForceFetchedback to summary
private final boolean areLazyAttributesForceFetched
dispositionback to summary
private final LoadPlan.Disposition disposition
querySpacesback to summary
private final QuerySpaces querySpaces
returnsback to summary
private final List<? extends Return> returns

Constructor Detail

LoadPlanImplback to summary
protected LoadPlanImpl(List<? extends Return> returns, QuerySpaces querySpaces, LoadPlan.Disposition disposition, boolean areLazyAttributesForceFetched)
LoadPlanImplback to summary
public LoadPlanImpl(EntityReturn rootReturn, QuerySpaces querySpaces)

Creates a Disposition#ENTITY_LOADER LoadPlan.

Parameters
rootReturn:EntityReturn

The EntityReturn representation of the entity being loaded.

querySpaces:QuerySpaces

The QuerySpaces containing all the query space references required for rootReturn and joined entity, collection, and composite references.

LoadPlanImplback to summary
public LoadPlanImpl(CollectionReturn rootReturn, QuerySpaces querySpaces)

Creates a Disposition#COLLECTION_INITIALIZER LoadPlan.

Parameters
rootReturn:CollectionReturn

The CollectionReturn representation of the collection being initialized.

querySpaces:QuerySpaces

The QuerySpaces containing all the query space references required for rootReturn and joined entity, collection, and composite references.

LoadPlanImplback to summary
public LoadPlanImpl(List<? extends Return> returns, QuerySpaces querySpaces, boolean areLazyAttributesForceFetched)

Creates a Disposition#MIXED LoadPlan.

Parameters
returns:List<? extends Return>

The mixed Return references

querySpaces:QuerySpaces

The QuerySpaces containing all the query space references required for rootReturn and joined entity, collection, and composite references.

areLazyAttributesForceFetched:boolean

Should lazy attributes (bytecode enhanced laziness) be fetched also? This effects the eventual SQL SELECT-clause which is why we have it here. Currently this is "all-or-none"; you can request that all lazy properties across all entities in the loadplan be force fetched or none. There is no entity-by-entity option. FETCH ALL PROPERTIES is the way this is requested in HQL. Would be nice to consider this entity-by-entity, as opposed to all-or-none. For example, "fetch the LOB value for the Item.image attribute, but no others (leave them lazy)". Not too concerned about having it at the attribute level.

Method Detail

areLazyAttributesForceFetchedback to summary
public boolean areLazyAttributesForceFetched()

Implements org.hibernate.loader.plan.spi.LoadPlan.areLazyAttributesForceFetched.

Doc from org.hibernate.loader.plan.spi.LoadPlan.areLazyAttributesForceFetched.

Does this load plan indicate that lazy attributes are to be force fetched?

Here we are talking about laziness in regards to the legacy bytecode enhancement which adds support for partial selects of an entity's state (e.g., skip loading a lob initially, wait until/if it is needed)

This one would effect the SQL that needs to get generated as well as how the result set would be read. Therefore we make this part of the LoadPlan contract.

NOTE that currently this is only relevant for HQL loaders when the HQL has specified the FETCH ALL PROPERTIES key-phrase. In all other cases, this returns false.

Returns:boolean

Whether or not to

Annotations
@Override
getDispositionback to summary
public LoadPlan.Disposition getDisposition()

Implements org.hibernate.loader.plan.spi.LoadPlan.getDisposition.

Doc from org.hibernate.loader.plan.spi.LoadPlan.getDisposition.

What is the disposition of this LoadPlan, in terms of its returns.

Returns:LoadPlan.Disposition

The LoadPlan's disposition

Annotations
@Override
getQuerySpacesback to summary
public QuerySpaces getQuerySpaces()

Implements org.hibernate.loader.plan.spi.LoadPlan.getQuerySpaces.

Doc from org.hibernate.loader.plan.spi.LoadPlan.getQuerySpaces.

Gets the QuerySpaces for the load plan, which contains a QuerySpace reference for each non-scalar return and for each entity, collection, and composite FetchSource.

When generating SQL, the query spaces provide data for the "from clause" including joins.

Returns:QuerySpaces

The QuerySpaces

Annotations
@Override
getReturnsback to summary
public List<? extends Return> getReturns()

Implements org.hibernate.loader.plan.spi.LoadPlan.getReturns.

Doc from org.hibernate.loader.plan.spi.LoadPlan.getReturns.

Get the returns indicated by this LoadPlan.

When generating SQL, the Returns provide columns/formulas used in the "select clause".

Returns:List<? extends Return>

The Returns for this LoadPlan.

Annotations
@Override
hasAnyScalarReturnsback to summary
public boolean hasAnyScalarReturns()

Implements org.hibernate.loader.plan.spi.LoadPlan.hasAnyScalarReturns.

Doc from org.hibernate.loader.plan.spi.LoadPlan.hasAnyScalarReturns.

Convenient form of checking getReturns() for scalar root returns.

Returns:boolean

true if getReturns() contained any scalar returns; false otherwise.

Annotations
@Override