RE: Creating dynamic query for collection of objects with max value field

Jamie Sammons, modified 4 Years ago. New Member Post: 1 Join Date: 11/12/20 Recent Posts

Hello!

I have collection of processInstanceIds and, I wanna find each task with max lastUpdateTime by one processInstanceId.
That is I have some tasks with same processInstanceId, but I need one task by the processInstanceId with max lastUpdateTime. And I need collection of tasks by the processInstanceIds.
I use disjunction (RestrictionsFactoryUtil.disjunction()) for each task criterion, but I dont know how I can do criterion with max lastUpdateTime for each task. I found .max() function, but its Projection and it returns the lastUpdateTime max values. I dont need it.

Does dynamic query has tools for this query?

thumbnail
Mohammed Yasin, modified 4 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts