-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Error when using
with
when the child references a parent but n…
…ot using the parent's id column, but rather another column that is a unique index. (#1902) - When a column in a child table references a column in the parent table that is not of type `EntityID`, a "is not in record set" error occurs because `entities.groupBy { it.readValues[parentTable.id] }` should be `entities.groupBy { it.readValues[refColumn] }` instead. - After that was fixed, when we loop over the entities grouped by `refColumn`, we attempt to store the referenced column value in the cache, which does not compile because it's not the right type expected by `cache.getOrPutReferrers`, so we need to find the parent entity that matches the value of the refColumn and use its entityId to store it in the cache. - The last step was to fix the invocation of `findById`, which was being invoked on `this`, which is the child entity, using `id as EntityID<ID>` which is for the parent entity. The fix is to find the child entity by using `refColumn`, which is the column in the child table that references the `id` in the parent table.
- Loading branch information
Showing
2 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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