Package org.hibernate.engine.profile
Class FetchProfile
- java.lang.Object
-
- org.hibernate.engine.profile.FetchProfile
-
public class FetchProfile extends Object
The runtime representation of a Hibernate fetch profile defined in annotations.Fetch profiles compete with JPA-defined named entity graphs. The semantics of these two facilities are not identical, however, since a fetch profile is a list, not a graph, and is not by nature rooted at any one particular entity. Instead, given a root entity as input, an active fetch profile contributes to the determination of the fetch graph.
A named fetch profile may be enabled in a given session by calling
Session.enableFetchProfile(String)
.- See Also:
FetchProfile
-
-
Constructor Summary
Constructors Constructor Description FetchProfile(String name)
Constructs a FetchProfile, supplying its unique name (unique within the SessionFactory).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFetch(Association association, String fetchStyleName)
Add a fetch override to the profile.void
addFetch(Association association, Fetch.Style style)
Add a fetch override to the profile.void
addFetch(Fetch fetch)
Add a fetch override to the profile.Fetch
getFetchByRole(String role)
Obtain the fetch associated with the given role.Map<String,Fetch>
getFetches()
Getter for property 'fetches'.String
getName()
Getter for property 'name'.boolean
isContainsJoinFetchedBag()
Getter for property 'containsJoinFetchedBag', which flags whether this fetch profile contained any bag join fetchesboolean
isContainsJoinFetchedCollection()
Getter for property 'containsJoinFetchedCollection', which flags whether this fetch profile contained any collection join fetches.
-
-
-
Constructor Detail
-
FetchProfile
public FetchProfile(String name)
Constructs a FetchProfile, supplying its unique name (unique within the SessionFactory).- Parameters:
name
- The name under which we are bound in the sessionFactory
-
-
Method Detail
-
addFetch
public void addFetch(Association association, String fetchStyleName)
Add a fetch override to the profile.- Parameters:
association
- The association to be fetchedfetchStyleName
- The name of the fetch style to apply
-
addFetch
public void addFetch(Association association, Fetch.Style style)
Add a fetch override to the profile.- Parameters:
association
- The association to be fetchedstyle
- The style to apply
-
addFetch
public void addFetch(Fetch fetch)
Add a fetch override to the profile.- Parameters:
fetch
- The fetch to add.
-
getName
public String getName()
Getter for property 'name'.- Returns:
- Value for property 'name'.
-
getFetches
public Map<String,Fetch> getFetches()
Getter for property 'fetches'. Map ofFetch
instances, keyed by associationrole
- Returns:
- Value for property 'fetches'.
-
getFetchByRole
public Fetch getFetchByRole(String role)
Obtain the fetch associated with the given role.- Parameters:
role
- The role identifying the fetch- Returns:
- The fetch, or
null
if a matching one was not found
-
isContainsJoinFetchedCollection
public boolean isContainsJoinFetchedCollection()
Getter for property 'containsJoinFetchedCollection', which flags whether this fetch profile contained any collection join fetches.- Returns:
- Value for property 'containsJoinFetchedCollection'.
-
isContainsJoinFetchedBag
public boolean isContainsJoinFetchedBag()
Getter for property 'containsJoinFetchedBag', which flags whether this fetch profile contained any bag join fetches- Returns:
- Value for property 'containsJoinFetchedBag'.
-
-