I’m trying to create a pie chart for my application-browse screen. I need to display a chart that shows the number of applications in each status. I’m using a view that includes status as it’s an entity. I can’t seem to get the query to work if I include a count(e) keyword. Here is my query:
select e.status
from edge$Application e
group by e.status
order by e.status
This is the error I receive within cuba:
IllegalArgumentException: Query select tempEntityAlias from edge$Status tempEntityAlias, edge$Application e where tempEntityAlias.id = e.status.id group by e.status order by e.status, query hint eclipselink.batch is not valid for this type of query.
Currently neither CollectionDatasource, nor DataManager query can return aggregates or single attributes - they can only return entities. This is because of security considerations - there can be restrictions on entity attributes and the platform generic mechanisms now can check them only inside entities.
We have plans for implementing a simple display of arbitrary data in tables and charts in a future release. It will be possible when we are able to fully analyze JPQL queries for attribute restrictions.