Hibernate ORM
  1. Hibernate ORM
  2. HHH-8285

Implement JPA 2.1 entity graph support

    Details

    • Type: Task Task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.3.0.Beta3
    • Fix Version/s: 4.3.0.CR1
    • Component/s: entity-manager
    • Labels:
    • Last commented by a user?:
      true

      Description

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

      @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.

        Issue Links

          Activity

          Hide
          Steve Ebersole added a comment -

          Hard for something not yet implemented to be a bug In fact as I have said in every 4.3 Beta release announcement support for entity graphs is the last piece of JPA 2.1 still being implemented, and the reason 4.3 is Beta and not CR.

          Show
          Steve Ebersole added a comment - Hard for something not yet implemented to be a bug In fact as I have said in every 4.3 Beta release announcement support for entity graphs is the last piece of JPA 2.1 still being implemented, and the reason 4.3 is Beta and not CR.
          Hide
          Steve Ebersole added a comment -

          Strong Liu Is this the issue key you are working under?

          Show
          Steve Ebersole added a comment - Strong Liu Is this the issue key you are working under?
          Hide
          Strong Liu added a comment -

          yes it is

          Show
          Strong Liu added a comment - yes it is
          Hide
          Steve Ebersole added a comment -

          Initial work here is done.

          Show
          Steve Ebersole added a comment - Initial work here is done.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 55m
                55m

                  Development