Repository navigation
fix: resolve relation values for join columns inside embedded entities - #12726
Merged
michaelbromley merged 3 commits intoJul 22, 2026
Merged
michaelbromley merged 3 commits into
michaelbromley merged 3 commits into
Conversation
commit: |
Code Review by Qodo
1.
|
alumni
approved these changes
Jul 22, 2026
gioboa
approved these changes
Jul 22, 2026
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.
Description of change
Fixes #12725
When a column inside an embedded entity is both an explicitly declared column and the join column of a relation (the relation id column pattern, e.g.
@Column() avatarIdalongside@ManyToOne() avatar), assigning a relation object to the embedded property was silently not persisted — on both INSERT and UPDATE. The same pattern on a non-embedded property works correctly.The cause: the embedded branch of
ColumnMetadata.getEntityValue()calledthis.relationMetadata.getEntityValue(embeddedObject), passing the already-extracted embedded object.RelationMetadata.getEntityValue()expects the full entity and performs the embedded-path traversal itself viaparentPropertyNames, so the relation value always resolved toundefinedand the code fell back to the explicit column property, which relation-object assignments do not populate. The value resolved toundefinedand the persistence layer skipped the column.The fix passes the full entity, mirroring what the non-embedded branch of the same method already does.
Verified with new regression tests in
test/functional/embedded/embedded-relation-id-column/:The full test suite passes against better-sqlite3 with no regressions.
Pull-Request Checklist
masterbranchFixes #12725tests/**.test.ts)docs/docs/**.md) N/A — bug fix, no documented behavior change