<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Creating dynamic query for collection of objects with max value field</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=120426925" />
  <subtitle>Creating dynamic query for collection of objects with max value field</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=120426925</id>
  <updated>2026-04-04T06:32:26Z</updated>
  <dc:date>2026-04-04T06:32:26Z</dc:date>
  <entry>
    <title>RE: Creating dynamic query for collection of objects with max value field</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120447542" />
    <author>
      <name>Mohammed Yasin</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120447542</id>
    <updated>2020-11-13T10:59:34Z</updated>
    <published>2020-11-13T10:59:34Z</published>
    <summary type="html">&lt;p&gt;Hi ,&lt;/p&gt;
&lt;p&gt;Have you checked below  post , it might be helpful to you&lt;/p&gt;
&lt;p&gt;
  &lt;a href="https://liferay.dev/blogs/-/blogs/revisiting-dynamicquery"&gt;https://liferay.dev/blogs/-/blogs/visiting-dynamicquery&lt;/a&gt;&lt;br /&gt;
  &lt;a href="https://liferay.dev/blogs/-/blogs/revisiting-dynamicquery"&gt;https://liferay.dev/blogs/-/blogs/revisiting-dynamicquery&lt;/a&gt;&lt;/p&gt;</summary>
    <dc:creator>Mohammed Yasin</dc:creator>
    <dc:date>2020-11-13T10:59:34Z</dc:date>
  </entry>
  <entry>
    <title>Creating dynamic query for collection of objects with max value field</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120426924" />
    <author>
      <name>Polina Svirelina</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120426924</id>
    <updated>2020-11-12T18:12:38Z</updated>
    <published>2020-11-12T09:59:12Z</published>
    <summary type="html">&lt;p&gt;Hello!&lt;br /&gt;
  &lt;br /&gt;I have collection of processInstanceIds and, I wanna find each
  task with max lastUpdateTime by one processInstanceId.&lt;br /&gt;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.&lt;br /&gt;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.&lt;/p&gt;
&lt;p&gt;Does dynamic query has tools for this query?&lt;/p&gt;</summary>
    <dc:creator>Polina Svirelina</dc:creator>
    <dc:date>2020-11-12T09:59:12Z</dc:date>
  </entry>
</feed>
