Problems with transaction #9605
Unanswered
ghost
asked this question in
Support Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I have a script that uses Doctrine ORM and underlying database connection. One of the dependencies the sciprt has, does a long running task (loops over a set of items) and it closes and reopens the connection to avoid timeouts with the database.
What happens, is that closing and reopening the connection rollbacks the first item processed in the transaction and then there's no transaction. The rest of the items are processed without transaction.
And when trying to commit the transaction over the set of items, the script crashes saying there's no active transaction to commit. Still, all the items except the first one are saved into the database.
Is this just coding failure or should there be some kind of detection in the ORM that if the connection is closed, the entity manager should be closed too?
Maybe there could be some kind of connection identifier stored with entity manager and then check it if it's still the same just before commit?
Since if the connection gets closed and re-opened, the entity manager could be out of sync, just like when there's an exception inside transaction etc.
Br, Miika
Beta Was this translation helpful? Give feedback.
All reactions