Uploaded image for project: 'Hibernate ORM'
  1. HHH-5465

HQL left join fetch of an element collection following a left join fetch of a one-to-one relationship causes NullPointerException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.5.4
    • Fix Version/s: 4.3.0.Beta3, 4.2.5
    • Component/s: query-hql
    • Labels:
      None
    • Environment:
      Hibernate 3.5.4, Postgresql 8.4, Java 6
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      HQL queries of the form
      "from EntityA a left join fetch a.entityB b left join fetch b.items"
      fail with a NullPointerExeption when EntityA and EntityB have a one-to-one (@OneToOne) relationship and EntityB.items is an element collection (@ElementCollection, aka collection of values).

      For comparison, the following HQL queries are all admissible (which intends to demonstrate that no particular clause of the the above HQL is incorrect):
      "from EntityB b left join fetch b.items"
      "from EntityA a left join fetch a.entityB"
      "from EntityA a left join fetch a.entityB.items"
      "from EntityA a left join fetch a.entityCs c left join fetch c.items" (where EntityA and EntityC have a one-to-many (@OneToMany) relationship, and EntityC.items is an element collection)

      Test code is attached. The log output along with thrown exception is attached as log.txt.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                7 Vote for this issue
                Watchers:
                8 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 - 1.15h
                  1.15h