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
Describe the bug
Lazily populating a bidirectional relation inadvertently writes any pending changes for the parent (and any onward relations) to the EntityManager's originalEntityData map. When the resulting UnitOfWork is committed, those changes are omitted from the changeSet and never written to the DB.
To Reproduce
Steps to reproduce the behavior:
Fetch an entity instance but don't populate any bidirectional relations
Change a property on the fetched instance (e.g. a scalar value)
Initialize a bidirectional relation and change it (e.g. add a new instance to a Collection)
Call em.persistAndFlush()
Expected behavior
Both changes are persisted to the database.
Actual behavior
Only the 2nd change, after the relation init(), is persisted.
Versions
Dependency
Version
node
13.10.1
typescript
3.8.3
mikro-orm
3.6.7
pg
7.18.2
The text was updated successfully, but these errors were encountered:
Describe the bug
Lazily populating a bidirectional relation inadvertently writes any pending changes for the parent (and any onward relations) to the EntityManager's
originalEntityData
map. When the resulting UnitOfWork is committed, those changes are omitted from the changeSet and never written to the DB.To Reproduce
Steps to reproduce the behavior:
em.persistAndFlush()
Expected behavior
Both changes are persisted to the database.
Actual behavior
Only the 2nd change, after the relation
init()
, is persisted.Versions
The text was updated successfully, but these errors were encountered: