[OpenNMS/opennms] c6b01a: NMS-20161: Apply criteria fetch modes after the di...
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: c6b01ad5ca0f47ee8de552b30c5084aefa328296
https://github.com/OpenNMS/opennms/commit/c6b01ad5ca0f47ee8de552b30c5084aefa328296
Author: Marshall Massengill <[email protected]>
Date: 2026-08-04 (Tue, 04 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: Apply criteria fetch modes after the distinct rewrite
HibernateCriteriaVisitor.visitFetch() set fetch modes directly on
m_criteria, but getCriteria() then implements distinct() by demoting that
criteria to an id-only subquery and building a new outer criteria. The
fetch modes went with the subquery, where Hibernate ignores them anyway
once a projection is set, so any criteria combining fetch(EAGER) with
distinct() silently got no join.
For v1 /rest/alarms this left OnmsAlarm.lastEvent as a lazy proxy read in
a separate statement per alarm, during hydration and after the alarm rows
had been read. An event deleted in that window by auto-clean reduction
raises ObjectNotFoundException, which OnmsAlarm.setLastEvent swallows, so
the broken proxy escapes the DAO and fails later inside the serializer,
truncating the response body.
Hold the fetch modes and apply them to the outer criteria after the
rewrite, the way m_orders already is.
Commit: cc60eb7f21f6ebe8c28b4721cb7eab231aface3a
https://github.com/OpenNMS/opennms/commit/cc60eb7f21f6ebe8c28b4721cb7eab231aface3a
Author: Marshall Massengill <[email protected]>
Date: 2026-08-04 (Tue, 04 Aug 2026)
Changed paths:
M opennms-webapp-rest/src/main/java/org/opennms/web/rest/v1/AlarmRestServiceBase.java
M opennms-webapp-rest/src/main/java/org/opennms/web/rest/v1/AlarmStatsRestService.java
Log Message:
-----------
NMS-20161: Remove the unresolvable firstEvent fetch from the v1 alarm criteria
OnmsAlarm has no firstEvent property. Its only OnmsEvent association is
lastEvent; firstEventTime is a plain column. Hibernate ignores fetch modes
whose path it cannot resolve, so this threw nothing before and throws
nothing now, but the preceding commit makes these declarations reach the
query, and a live fetch mode that resolves to nothing is a trap for the
next reader.
Compare: https://github.com/OpenNMS/opennms/compare/c6b01ad5ca0f%5E...cc60eb7f21f6
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