-
-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Insert does not occur when finding a somewhat unrelated entity. [v3.6.15 & v4-rc.8] #811
Comments
Could you try to upgrade to v4 to see if it helps? Also try to build your entities directly (via ctors, not em.create()). There were some improvements in em.create() as well as change set computation. Btw calling em.remove() without flushing does nothing. Also doing persist without flushing is just marking the entity, that should not matter here. You always need to flush to make changes (in general you always need to await something, dont expect sync operations to work with the database). |
I can't upgrade this codebase to v4 yet until rc7 drops and fixes #806. Once I can get it running we'll leave v3 behind and switch to v4. My code isn't ready for production anyways and v4 looks really nice. I updated my repo branch with the changes you suggested but it's still causing issues. I can get it to work by doing one of the following:
Neither of these are fixes though. I guess this still stands as a bug in v3. I'll test this in v4 as soon as rc7 releases. |
It's passing with v4. |
Hmm. I just updated my test repo from v3 to v4-rc8 and I'm still getting the same issue. The v4 test repo is here: https://github.com/darkadept/mikro-orm-test/tree/v4-test-new-ent |
Lol, so I did test on sqlite and there it is passing just fine (be26598), but with postgres the same test fails. |
Ok interesting. So in sqlite it was passing because there were no FKs. The core issue here was that when you loaded the With the fix, we now store internal flag on entities to know whether they were loaded from db or created via constructor (or |
Confirmed working in v4.0.0. Thanks so much for your hard work! |
I have three entities:
contact.address
.Step 4 is seemingly completely unrelated to step 2 and 3, yet if try to find an employee it causes the insert for my address to not occur.
Stack trace
To Reproduce
yarn install
yarn start
<-- this does everything(Note: I tried to make this repo really easy to use with the start script. I hope it works for you.)
Expected behavior
My SQL statements in the above stack trace should also have an insert:
Versions
The text was updated successfully, but these errors were encountered: