EntityHook: Duplicate EntityChanges per transaction
See original GitHub issueI have a question about the entity hook and the registered entity changes.
When a change gets registered there is a check if that change was already registered. But the code above only checks if the last added change is equal to the current change. If there was a different change in the meantime the duplicate change will be registered anyhow. I’m not sure if this is on purpose but I would consider all changes on the same entity in the same transaction to be ‘one’ change in any case (also if there are changes on other entities in between). So I would change the code to this:
fun registerChange(transaction: Transaction, change: EntityChange) {
if (change !in transaction.entityEvents) {
transaction.entityEvents.add(change)
}
}
What is your opinion about this?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
How to intercept entity changes with Hibernate event listeners
Learn how to intercept entity changes (persist, merge, remove) using Hibernate event listeners and replicate changes to other database ...
Read more >Test data creation with Kotlin DSL and Exposed - neetkee.com
In this post, I will describe how you can use the power of Kotlin DSL and Exposed for test entities creation. If you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Tapac Thanks for the feedback. What would also help is to provide some kind of transaction identifier in the entity change event so the subscribers know which events were triggered within the same transaction. Maybe each transaction could have a unique UUID which is used for this. What do you think?
Released in 0.20.1