0 Replies Latest reply on Jul 20, 2015 5:24 PM by Karthik Srinivasan

    Envers Unidirectional OneToMany MappedBy

    Karthik Srinivasan Newbie

      Not Sure If this Issue is already resolved. Please let me know the link if it is already resolved.


      Parent  Class has list of child

       

      @Entity

      @Table(name = "DUA")

      @Audited

      public class DuaVO{

       

           @Id

          @Column(name = "DUA_NUM")

          private String duaNumber;

       

       

       

           @OneToMany(mappedBy = "duaNumber", fetch = FetchType.LAZY)

          @Fetch(FetchMode.SELECT)

          @AuditJoinTable(name = "EPPE_DUA_DATA_FILE_AUD")

          private List<DuaDataFileVO> dataFileDescriptionList = new ArrayList<DuaDataFileVO>();

       

      ....}

       

      Child Class has foreign key from Parent.

       

       

      @Entity

      @Table(name = "DUA_DATA_FIL")

      @Audited

      public class DuaDataFileVO

      {

           @Id

          @Column(name = "DUA_DATA_FIL_ID")

          private Long duaDataFileId;

       

            @Column(name = "DUA_NUM")

          private String duaNumber;

       

      ...}

       

      Using Audit Reader to find entity by Revision Number

      auditReader.find(DuaVO.class, id, revision);

       

      Error

       

      org.hibernate.QueryException: could not resolve property: duaNumber_duaNumber of: DuaDataFileVO_AUD [select e__ from DuaDataFileVO_AUD e__ where e__.duaNumber_duaNumber = :duaNumber_duaNumber and e__.originalId.REV.id = (select max(e2__.originalId.REV.id) from .DuaDataFileVO_AUD e2__ where e2__.originalId.REV.id <= :revision and e__.originalId.duaDataFileId = e2__.originalId.duaDataFileId) and REVTYPE != :delrevisiontype]