JPQL max() function

I was in need of the result of a max() function in JPQL today but after some testing I found that max() does not seem to be supported in CUBA’s JPQL implementation. So…

  1. Is this true that max() is not supported?
  2. For those looking for this functionality, use a CASe statement in a subquery.


The JPQL max() function is supported, see JPQL Functions.
How are you trying to use it? Be aware, that in order to load scalar and aggregate (non-entity) values, you need to use KeyValue Containers or DataManager.loadValues() method.

The documentation doesn’t reference the max() function so that’s why I assumed it was not supported. I was also trying to use it in a subquery as part of a CollectionDatasource query which is probably why it didn’t work when I attempted to use the function despite not seeing it in the docs. But, good info for the future. Thanks.