You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you run a select/find query on an entity whose relation has the foreign key as primary and request a nested relation (i.e ['admin', 'admin.organization']) you receive an entity with null values rather than null.
For example, with 3 entities User, Admin, and OrganizationUser -> Admin -> Organization and Admin has the user foreign relation as the primary key, if you request a User but ask for ['admin', 'admin.organization'] in relations it will return the User with an empty Admin object rather than null. If you only request ['admin'] without admin.organization it works properly.
Expected Behavior
After querying for the entity and the relation was not found it would return the value 'null' for that relation.
Actual Behavior
After querying the entity and the relation was not found, the relation is set to an entity with all values as null
This example was created using one-to-one relationships but works with any relationship where the primary key is the foreign key
Interesting aside... Moving the JoinColumn between admin and organization from admin to organization causes the 'admin.organization' relationship to fail as the ON part of the left join is not populated
Relevant Database Driver(s)
aurora-data-api
aurora-data-api-pg
better-sqlite3
cockroachdb
cordova
expo
mongodb
mysql
nativescript
oracle
postgres
react-native
sap
sqlite
sqlite-abstract
sqljs
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, and I know how to start.
Yes, I have the time, but I don't know how to start. I would need guidance.
No, I don't have the time, although I believe I could do it if I had the time...
No, I don't have the time and I wouldn't even know how to start.
The text was updated successfully, but these errors were encountered:
Issue Description
When you run a select/find query on an entity whose relation has the foreign key as primary and request a nested relation (i.e
['admin', 'admin.organization']
) you receive an entity with null values rather thannull
.For example, with 3 entities
User
,Admin
, andOrganization
User -> Admin -> Organization
andAdmin
has the user foreign relation as the primary key, if you request aUser
but ask for['admin', 'admin.organization']
in relations it will return theUser
with an emptyAdmin
object rather thannull
. If you only request['admin']
withoutadmin.organization
it works properly.Expected Behavior
After querying for the entity and the relation was not found it would return the value 'null' for that relation.
Actual Behavior
After querying the entity and the relation was not found, the relation is set to an entity with all values as null
Steps to Reproduce
My Environment
Additional Context
This example was created using one-to-one relationships but works with any relationship where the primary key is the foreign key
Interesting aside... Moving the JoinColumn between admin and organization from admin to organization causes the 'admin.organization' relationship to fail as the ON part of the left join is not populated
Relevant Database Driver(s)
aurora-data-api
aurora-data-api-pg
better-sqlite3
cockroachdb
cordova
expo
mongodb
mysql
nativescript
oracle
postgres
react-native
sap
sqlite
sqlite-abstract
sqljs
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: