1 Reply Latest reply on Jul 21, 2010 4:47 AM by armahdi

    auditreader query: how to list revisions on a manytoone relation

    armahdi

      Hi All,

       

      I am trying to write a query for a relationship between an department that can have Many employees

       

      Now i am trying to write with a list of employee-Ids

       

      query.add(AuditEntity.property("employee").in(employeeList));

       

      but this will take a LIST of employee objects not a list of Integer Ids (right??)

       

      So, I tried

       

       

      query.add(AuditEntity.relatedId("employee").in(employeeIdList))

       

       

       

      But there is no such method in() with AuditRelatedId object.

       

      So My question is that if my class is like this:

       

      public class Department{

       

      private Integer Id;

       

      private Employee employee;

      }

       

      public class Employee{

      private Integer id;

      private String name;

      private String contarctingcompany;

      }

       

      Then I retrieve a list of Employees belonging to a contracting company. from where I get all the Ids  of those employees now i have to find the revisions for the department that contains those employee Ids. (Can i use Employee Objects to retreive the department in the first query.add i wrote ??) If the requirement requires me to use Employee Ids as the search criteria is there a possible way for it.

       

      Im trying but not able to get through.

      Any help will be appreciated.

       

      Thanks

      Syed