This content has been marked as final.
Show 1 reply
-
1. Re: How to access data returned by AuditQuery.getResultList();
zmelvin May 16, 2012 11:11 AM (in response to zmelvin)okay...apparently the answer is to completely read the documentation.
forRevisionsOfEntity
public AuditQuery forRevisionsOfEntity(Class<?> c, String entityName, boolean selectEntitiesOnly, boolean selectDeletedEntities)
- Creates a query, which selects the revisions, at which the given entity was modified and with a given entityName. Unless an explicit projection is set, the result will be a list of three-element arrays, containing:
- the entity instance
- revision entity, corresponding to the revision at which the entity was modified. If no custom revision entity is used, this will be an instance of
DefaultRevisionEntity
- type of the revision (an enum instance of class
RevisionType
)
so the Array is returned and I need to do some casting to get the data I seek.
List<Object> objList = query.getResultList();
Object[] objArray = (Object[])objList.get(0);
MyEntity myEntity = (MyEntity)objArray[0];
with proper exception handling added of course.
Zak
- Creates a query, which selects the revisions, at which the given entity was modified and with a given entityName. Unless an explicit projection is set, the result will be a list of three-element arrays, containing: