We're updating the issue view to help you get more done. 

Implement JPA 2.1 entity graph support

Description

IMHO Chapter 3.7.4.2 of the JPA spec says that @NamedEntityGraph can be used instead of fetch joins. For instance:

1 2 3 4 5 6 7 8 9 10 11 @Entity @Table(name = "kunde") @DiscriminatorColumn(name = "art", length = 1) @NamedQueries({...}) @NamedEntityGraphs({@NamedEntityGraph(name = "bestellungen", attributeNodes = @NamedAttributeNode("bestellungen"))}) public abstract class AbstractKunde implements Serializable, Cloneable {...} // 2 concrete classes are derived from the abstract class @PersistenceContext private EntityManager em; ... List<AbstractKunde> kunden = em.createNamedQuery("...", AbstractKunde.class).setParameter("...", "...").setHint("javax.persistence.loadgraph", "bestellungen").getResultList();

When I try to access the attribute "bestellungen" after committing the transaction, then I get a LazyInitializationException.

Environment

None

Status

Assignee

Steve Ebersole

Reporter

Juergen Zimmermann

Labels

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

4.3.0.Beta3

Priority

Major