0 Replies Latest reply on Nov 28, 2012 5:05 AM by francesco.bragagna

    Query for revision at which entities of a given class changed in a specific attribute

    francesco.bragagna

      I'm trying to query for revisions (LIST!) where a specific object property is changed. In the documentation example you have a person class with id, name, surname and address.

       

      can find all the revision where a specific class instance is changed

      auditReader.getRevisions(entityClass, entityName, id);

      But this is not a query.

      I'm trying to do something like (given entityClass, id and attributeName?):

      auditReader.createQuery().forRevisionsOfEntity(entityClass, false, true)

      .add(AuditEntity.id().eq(id))

      .add(AuditEntity.property(attributeName).ne(AuditEntity.GETPREVIOUS?().property(attributeName)))

      I don't know how exacly how to write this restriction in the query, to see the change to only one attribute...

      ...Or how to write the attribute is different from the previous revision of this object.

       

      I can get all the revision list, cycle between them, couple by couple (previous and next), where a specific attribute is changed and get only them. But I like to understand if there is any way to do it with the query. –

       

      Thank you

      Francesco