Skip to content

CAY-3078 Disjoint to-one prefetch doesn't attach parents over binary keys - #659

Open
Jugen wants to merge 1 commit into
STABLE-5.0from
binary-key-prefetch-attachment
Open

Jugen wants to merge 1 commit into
STABLE-5.0from
binary-key-prefetch-attachment

Conversation

@Jugen

@Jugen Jugen commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem: A disjoint() or disjointById() to-one prefetch over a binary (byte[]) FK doesn’t set the relationship on the source objects. readPropertyDirectly(...) returns null.

Cause: ResultScanParentAttachmentStrategy indexes parents in a HashMap keyed by raw join values, and byte[] uses identity equals/hashCode. Compound keys have the same problem, because List.equals compares the elements by identity.

Fix: Wrap byte[] join values, including each element of a compound key, in ByteBuffer, which compares by content.

Tests: Two new tests in DataContextBinaryPKIT (disjoint and disjointById) that assert the attachment with queries blocked.

Related: the disjointById case with several keys also needs CAY-3079 (IN list binding).

@Jugen
Jugen marked this pull request as ready for review November 16, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant