3 Replies Latest reply on Jan 9, 2014 11:26 AM by Kent Gibson

    is join two entities in audit query possible?

    Tamilselvi Dhandapani Newbie



      Am using Envers version : 3.6.3.Final

      I wanted to join two audit tables having a one to many relationship, with criteria's to be passed on both the tables.


      For eg: Event.java


      @OneToMany(mappedBy = "event", fetch = FetchType.LAZY, orphanRemoval = true)

          @Cascade(value = { CascadeType.ALL })

          private List<Agreement>     agreements          = new ArrayList<Agreement>();





      @ManyToOne(fetch = FetchType.LAZY)

          @JoinColumn(name = "ID_EVENT")

          private Event             event;


      i want to fetch the event by passing an ID and date of the event and also the status of the agreement.And the result should be the latest version on that date.

      How can i join these conditions in the audit query?

      Can i make all these conditions in a single query?


      My query is  :

      AuditQuery query = reader.createQuery().forRevisionsOfEntity(Event.java, false, true);






      I have changed here and there and tried but nothing worked.


      Please advice on this issue.


      Thanks in Advance,