Querying Entity Log Attributes

Hi,
I’m trying to display a specific field (that’s changed) from the Entity Log but am not sure how I do that. Following the docs, I have setup a datasource as below


<collectionDatasource id="logDs"
        class="com.haulmont.cuba.security.entity.EntityLogItem"
         view="logView">
  <query>
    <![CDATA[select i from sec$EntityLog i
    where i.entityId = :ds$customerDs 
    order by i.eventTs]]>
  </query>
  <collectionDatasource id="logAttrDs"
        property="attributes"/>
</collectionDatasource>

My question, in the nested ds, how do I filter for an attribute that is named ‘status’ only?

p.s. I have looked in the corresponding attribute table, SEC_ENTITY_LOG_ATTR, but it is empty. So I’m guessing the CHANGES column is being parsed from SEC_ENTITY_LOG?

Thanks,
Eddy

Hi Eddy,

You are right, EntityLogAttr instances are stored together with owning EntityLogItem. You can filter them out only by removing from the logAttrDs datasource programmatically. Use excludeItem() method in the postInit() or ready() method of your controller, and set allowCommit=“false” for the logDs datasource to ensure that changes won’t be committed.