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
I'm using EntityHooks to maintain an updatedAt column on my entities and need the updatedAt value during the same transaction where the entity was updated. As the EntityHooks are only called on commit, I added a Entity.flush() call to force Exposed to flush the outstanding update & so the updatedAt hook to take effect.
Expected behaviour
Looking at the code of the flush() function it adds an update event to the queue. I expected calling flush() with outstanding updates will also notify EntityHook subscribers.
Hey,
I'm using EntityHooks to maintain an
updatedAt
column on my entities and need theupdatedAt
value during the same transaction where the entity was updated. As the EntityHooks are only called on commit, I added aEntity.flush()
call to force Exposed to flush the outstanding update & so theupdatedAt
hook to take effect.Expected behaviour
Looking at the code of the
flush()
function it adds an update event to the queue. I expected callingflush()
with outstanding updates will also notify EntityHook subscribers.I added a test repo here to showcase the expected behaviour: https://github.com/KennethWussmann/exposed-entity-flush-hook-bug/blob/main/src/test/kotlin/exposedissue/EntityHookTest.kt#L18-L59
Actual behaviour
Calling
flush()
doesn't notify EntityHook subscribers, even though it commitsUPDATE
statements to the database.I also added a test to show how it currently looks like: https://github.com/KennethWussmann/exposed-entity-flush-hook-bug/blob/main/src/test/kotlin/exposedissue/EntityHookTest.kt#L61-L103
Version used:
0.31.1
Thank you!
The text was updated successfully, but these errors were encountered: