Added ModelIllegalStateException to handle lazy loading exception.#9761
Added ModelIllegalStateException to handle lazy loading exception.#9761hmlnarik merged 1 commit intokeycloak:mainfrom
Conversation
|
This makes sure that the updated delegate exists in the database and that its optimistic locking version hasn't changed. After this change the ConcurrencyTest with JPA Map storage completes. Design changes:
Optional stuff (please comment):
Will need to do the same changes in #9746 (Client Scope for JPA Map) as well. |
|
Testing this yesterday, I found that the optimistic locking failed when updating only some attributes: the version in the parent wasn't incremented as the the ManyToOne relation is owned by the child. I looked for a simple solution to change that ownership, but didn't succeed. I then added some hibernate listeners and iterfaces to trigger the essential I added a second commit to this PR to keep them separate for an initial review and comment. After initial feedback on the approach I'll then merge them. The approach is inspired by https://vladmihalcea.com/jpa-entity-version-property-hibernate/ and https://vladmihalcea.com/hibernate-event-listeners/. I tested it manually by changing role attribute or changing a client's "Backchannel Logout Session Required" @vramik, @sguilhen, @hmlnarik - I'd be happy if you could have a look. |
vramik
left a comment
There was a problem hiding this comment.
Thank you @ahus1. On the first look it seems good to me. I haven't tried it yet.
I've noticed one thing (please see inline) what attracted my attention. Could you please in the meantime take a look while I'll take a closer look. Thank you.
36876e5 to
e258df3
Compare
e258df3 to
91b4772
Compare
91b4772 to
bdaac6b
Compare
|
After a conversation with @hmlnarik the changes about the hibernate listener described in #9761 (comment) are no longer part of this ticket; they will be covered in a future ticket. Work on that will start once this has been merged. Previous commit still available here: 4c0bcee21d106a8451b89ec94c122bf75ac0d8e8 |
403a739 to
a08e753
Compare
a08e753 to
0acd011
Compare
|
@sguilhen - Thanks for the review. I updated this PR according to your review comments. Please have another go if this is good to go. Thanks! |
Closes #9645