O3-5696: Fix Wrong ORM mapping, duplicate DB lookup & null crash - #115
Open
UjjawalPrabhat wants to merge 3 commits into
Open
O3-5696: Fix Wrong ORM mapping, duplicate DB lookup & null crash#115UjjawalPrabhat wants to merge 3 commits into
UjjawalPrabhat wants to merge 3 commits into
Conversation
|
|
@claude review |
dkayiwa
reviewed
Jul 30, 2026
QueueEntrySubResource.getDisplay had the same unguarded patient
dereference as QueueEntryResource, and served the same display property
for the same entity from GET /ws/rest/v1/queue/{uuid}/entry. Guarding
only one getter left that endpoint exposed to the same crash.
dkayiwa
reviewed
Jul 31, 2026
Member
|
@claude review |
Aligning QueueEntrySubResource.getDisplay with QueueEntryResource changed the all-names-voided branch from "" to patient.toString(), and nothing covered it. That branch is the one known to occur: it dates to 2c4f7f1 "Fix NPE for patients without unvoided names".
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Three independent backend defects in the queue module:
QueueEntry.queueComingFromwas mapped@OneToOnethough many entries can transition from the same source queue. Switch to@ManyToOne, matching the other associations. Mapping correctness only, no behaviour change: Hibernate binds an owning-side@OneToOnewith a join column as aManyToOneTypeanyway, and the generated schema is identical.AbstractBaseQueueDaoImpl.get(uuid)executed its criteria query twice, discarding the first result. Drop the redundant call so each UUID lookup runs exactly one query (affects all queue DAOs via the base).getDisplaynull-checkedpersonNamebut dereferenced a possibly-null patient first, in bothQueueEntryResourceandQueueEntrySubResource. Null-check the patient and fall back to the queue entry UUID, in both, with unit tests. Hardening rather than a reproducible crash:patient_idis NOT NULL and validation rejects a null patient, so no in-module path writes such a row. It guards rows written from outside, and makes the two getters agree.