Top Description Methods
javax.persistence

public Interface Subgraph<T>

Type Parameters
<T>
The type of the attribute.
Imports
javax.persistence.metamodel.Attribute, java.util.List

This type represents a subgraph for an attribute node that corresponds to a Managed Type. Using this class, an entity subgraph can be embedded within an EntityGraph.
Since
Java Persistence 2.1
See Also
EntityGraph, AttributeNode, NamedSubgraph

Method Summary

Modifier and TypeMethod and Description
public void
addAttributeNodes(String...
name of the attribute
attributeName
)

Add one or more attribute nodes to the entity graph.

public void
addAttributeNodes(Attribute<T, ?>...
attribute
attribute
)

Add one or more attribute nodes to the entity graph.

public <X> Subgraph<X>

Returns:

subgraph for the key attribute
addKeySubgraph
(Attribute<T, X>
attribute
attribute
)

Add a node to the graph that corresponds to a map key that is a managed type.

public <X> Subgraph<? extends X>

Returns:

subgraph for the attribute
addKeySubgraph
(Attribute<T, X>
attribute
attribute
,
Class<? extends X>
entity subclass
type
)

Add a node to the graph that corresponds to a map key that is a managed type with inheritance.

public <X> Subgraph<X>

Returns:

subgraph for the key attribute
addKeySubgraph
(String
name of the attribute
attributeName
)

Add a node to the graph that corresponds to a map key that is a managed type.

public <X> Subgraph<X>

Returns:

subgraph for the attribute
addKeySubgraph
(String
name of the attribute
attributeName
,
Class<X>
entity subclass
type
)

Add a node to the graph that corresponds to a map key that is a managed type with inheritance.

public <X> Subgraph<X>

Returns:

subgraph for the attribute
addSubgraph
(Attribute<T, X>
attribute
attribute
)

Add a node to the graph that corresponds to a managed type.

public <X> Subgraph<? extends X>

Returns:

subgraph for the attribute
addSubgraph
(Attribute<T, X>
attribute
attribute
,
Class<? extends X>
entity subclass
type
)

Add a node to the graph that corresponds to a managed type with inheritance.

public <X> Subgraph<X>

Returns:

subgraph for the attribute
addSubgraph
(String
name of the attribute
attributeName
)

Add a node to the graph that corresponds to a managed type.

public <X> Subgraph<X>

Returns:

subgraph for the attribute
addSubgraph
(String
name of the attribute
attributeName
,
Class<X>
entity subclass
type
)

Add a node to the graph that corresponds to a managed type with inheritance.

public List<AttributeNode<?>>

Returns:

list of attribute nodes included in the subgraph or empty List if none have been defined
getAttributeNodes
()

Return the attribute nodes corresponding to the attributes of this managed type that are included in the subgraph.

public Class<T>

Returns:

managed type referenced by the subgraph
getClassType
()

Return the type for which this subgraph was defined.

Method Detail

addAttributeNodesback to summary
public void addAttributeNodes(String... attributeName)

Add one or more attribute nodes to the entity graph.

Parameters
attributeName:String[]

name of the attribute

Exceptions
IllegalArgumentException:
if the attribute is not an attribute of this managed type.
IllegalStateException:
if the EntityGraph has been statically defined
addAttributeNodesback to summary
public void addAttributeNodes(Attribute<T, ?>... attribute)

Add one or more attribute nodes to the entity graph.

Parameters
attribute:Attribute<T, ?>[]

attribute

Exceptions
IllegalStateException:
if this EntityGraph has been statically defined
addKeySubgraphback to summary
public <X> Subgraph<X> addKeySubgraph(Attribute<T, X> attribute)

Add a node to the graph that corresponds to a map key that is a managed type. This allows for construction of multinode entity graphs that include related managed types.

Parameters
attribute:Attribute<T, X>

attribute

Returns:Subgraph<X>

subgraph for the key attribute

Exceptions
IllegalArgumentException:
if the attribute's target type is not a managed type entity
IllegalStateException:
if this EntityGraph has been statically defined
addKeySubgraphback to summary
public <X> Subgraph<? extends X> addKeySubgraph(Attribute<T, X> attribute, Class<? extends X> type)

Add a node to the graph that corresponds to a map key that is a managed type with inheritance. This allows for construction of multi-node entity graphs that include related managed types. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs

Parameters
attribute:Attribute<T, X>

attribute

type:Class<? extends X>

entity subclass

Returns:Subgraph<? extends X>

subgraph for the attribute

Exceptions
IllegalArgumentException:
if the attribute's target type is not a managed type entity
IllegalStateException:
if this EntityGraph has been statically defined
addKeySubgraphback to summary
public <X> Subgraph<X> addKeySubgraph(String attributeName)

Add a node to the graph that corresponds to a map key that is a managed type. This allows for construction of multi-node entity graphs that include related managed types.

Parameters
attributeName:String

name of the attribute

Returns:Subgraph<X>

subgraph for the key attribute

Exceptions
IllegalArgumentException:
  • if the attribute is not an attribute of this entity.
  • if the attribute's target type is not a managed type
IllegalStateException:
if this EntityGraph has been statically defined
addKeySubgraphback to summary
public <X> Subgraph<X> addKeySubgraph(String attributeName, Class<X> type)

Add a node to the graph that corresponds to a map key that is a managed type with inheritance. This allows for construction of multi-node entity graphs that include related managed types. Subclass subgraphs will include the specified attributes of superclass subgraphs

Parameters
attributeName:String

name of the attribute

type:Class<X>

entity subclass

Returns:Subgraph<X>

subgraph for the attribute

Exceptions
IllegalArgumentException:
  • if the attribute is not an attribute of this entity.
  • if the attribute's target type is not a managed type
IllegalStateException:
if this EntityGraph has been statically defined
addSubgraphback to summary
public <X> Subgraph<X> addSubgraph(Attribute<T, X> attribute)

Add a node to the graph that corresponds to a managed type. This allows for construction of multi-node entity graphs that include related managed types.

Parameters
attribute:Attribute<T, X>

attribute

Returns:Subgraph<X>

subgraph for the attribute

Exceptions
IllegalArgumentException:
if the attribute's target type is not a managed type
IllegalStateException:
if the EntityGraph has been statically defined
addSubgraphback to summary
public <X> Subgraph<? extends X> addSubgraph(Attribute<T, X> attribute, Class<? extends X> type)

Add a node to the graph that corresponds to a managed type with inheritance. This allows for multiple subclass subgraphs to be defined for this node of the entity graph. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs

Parameters
attribute:Attribute<T, X>

attribute

type:Class<? extends X>

entity subclass

Returns:Subgraph<? extends X>

subgraph for the attribute

Exceptions
IllegalArgumentException:
if the attribute's target type is not a managed type
IllegalStateException:
if this EntityGraph has been statically defined
addSubgraphback to summary
public <X> Subgraph<X> addSubgraph(String attributeName)

Add a node to the graph that corresponds to a managed type. This allows for construction of multi-node entity graphs that include related managed types.

Parameters
attributeName:String

name of the attribute

Returns:Subgraph<X>

subgraph for the attribute

Exceptions
IllegalArgumentException:
  • if the attribute is not an attribute of this managed type.
  • if the attribute's target type is not a managed type
IllegalStateException:
if this EntityGraph has been statically defined
addSubgraphback to summary
public <X> Subgraph<X> addSubgraph(String attributeName, Class<X> type)

Add a node to the graph that corresponds to a managed type with inheritance. This allows for multiple subclass subgraphs to be defined for this node of the entity graph. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs

Parameters
attributeName:String

name of the attribute

type:Class<X>

entity subclass

Returns:Subgraph<X>

subgraph for the attribute

Exceptions
IllegalArgumentException:
  • if the attribute is not an attribute of this managed type.
  • if the attribute's target type is not a managed type
IllegalStateException:
if this EntityGraph has been statically defined
getAttributeNodesback to summary
public List<AttributeNode<?>> getAttributeNodes()

Return the attribute nodes corresponding to the attributes of this managed type that are included in the subgraph.

Returns:List<AttributeNode<?>>

list of attribute nodes included in the subgraph or empty List if none have been defined

getClassTypeback to summary
public Class<T> getClassType()

Return the type for which this subgraph was defined.

Returns:Class<T>

managed type referenced by the subgraph