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

NullPointerException when reading an audited entity that has a collection of embeddables with a ManyToOne to an unaudited entity.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 5.2.4
    • Fix Version/s: 5.2.5, 5.1.8
    • Component/s: hibernate-envers
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      When using an audited entity collection of an embeddable:

      @Audited
      public class Parent {
        // ...
        @ElementCollection
        @CollectionTable(name = "items", joinColumns = @JoinColumn(name = "PRODUCT_ID"))
        @OrderColumn(name = "ORDER_COL")
        @Audited
        private List<Item> items = new ArrayList<Item>();
      }
      
      @Embeddable
      @Audited
      public class Item {
        // ...
        @ManyToOne
        @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
        private Type type;
      }
      

      This causes a NullPointerException to occur when fetching a revision of the Parent entity when the embeddable Item contains a non-null reference to Type, which is not audited. This is only an issue when the embeddable class holds a reference to a non-audited entity.

        Attachments

          Issue links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: