I migrated to platform7.0.1 and wanted to try out charts.
I created a simple MetaClass containing a date and a value (all metaProperties).
My screen xml contains a data section like
<data>
<collection id="datacollection" class="com.mynamespace.Meta" view="_minimal">
<loader id="datacollectionloader">
<query>
<![CDATA[select new com.mynamespace.Meta(g.day, count(g)) from myapp$persistententries g where g.type = 'whatever' group by g.day]]></query>
</loader>
</collection>
</data>
Load gets called on the collection loader (either via @LoadDataBeforeShow or by calling it manually in OnBeforeShow). (Verified by setting a loadDelegate temporarily).
But the collection is always empty. When I execute the query in jmxConsole/Persistence Manager I get correct values (correctly transformed to my MetaClass (verified by overwriting toString which is used in the results view))
Such query won’t work for normal data container/loader, because you specify a non-persistent class as the data container content, and the query just doesn’t go to data store. It can work through EntityManager, because it is valid from the ORM perspective, but not through DataManager. This is why you see it executed correctly via Persistence Manager.
When you need to load some arbitrary values in screens (or in general via DataManager), use KeyValueEntity instead of your custom non-persistent classes. There are special data containers that require defining of entity properties, see KeyValue Containers.
In your case the XML definition may look as follows:
<data>
<keyValueCollection id="datacollection">
<loader id="datacollectionloader">
<properties>
<property name="day"/>
<property name="count"/>
</properties>
<query>
<![CDATA[select g.day, count(g) from myapp$persistententries g where g.type = 'whatever' group by g.day]]></query>
</loader>
</collection>
</data>
well, that’s it. I wasn’t aware of the differences of DataManager, EntityManager and Persistence Manager in the usage of data containers.
KeyValue Container works like a charm.
KeyValue Containers where misleading for me. I thought in “1key - 1 value”. The little word “arbitrary” in the documentation changes the meaning a lot