[OpenNMS/opennms] 8422d9: NMS-20161: Keep to-many fetches out of the distinc...

Marshall Massengill via opennms-cvs <[email protected]>
Newsgroups gmane.network.opennms.cvs
Message-ID <OpenNMS/opennms/push/refs/heads/mm/NMS-20161-smoke/[email protected]>
  Branch: refs/heads/mm/NMS-20161-smoke
  Home:   https://github.com/OpenNMS/opennms
  Commit: 8422d94006d4dc07ff030f2a8a755484bc61047e
      https://github.com/OpenNMS/opennms/commit/8422d94006d4dc07ff030f2a8a755484bc61047e
  Author: Marshall Massengill <[email protected]>
  Date:   2026-08-12 (Wed, 12 Aug 2026)

  Changed paths:
    M opennms-dao/src/main/java/org/opennms/netmgt/dao/hibernate/HibernateCriteriaConverter.java
    M opennms-dao/src/test/java/org/opennms/netmgt/dao/hibernate/HibernateCriteriaConverterIT.java

  Log Message:
  -----------
  NMS-20161: Keep to-many fetches out of the distinct outer criteria

Applying the held fetch modes to the outer criteria makes them live for
every association, not just the to-one ones the alarm criteria needs. A
join fetch of a collection returns one outer row per element, which would
undo the distinct() rewrite it is applied after and leave setMaxResults
counting joined rows rather than entities. No caller fetches a collection
today, but the declaration now reaches the query, so the trap is real.

Ask the session factory whether the path is collection-valued and skip
those fetches, leaving the association to load the way it did when the
fetch modes still went to the subquery. Answering that needs a
SessionFactory, so the two entry points that take a Session hand theirs to
the visitor; the detached overloads, which nothing calls, still apply
every fetch mode.



To unsubscribe from these emails, change your notification settings at https://github.com/OpenNMS/opennms/settings/notifications


_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/wiki/index.php?page=MailingListFaq
opennms-cvs mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.