java - jpa way to see if entity or one of its relations has changed version -


i'm looking way find out if detached entity has changed in database. furthermore want know if of relations cascade = cascadetype.merge has changed. entity , of relations have version field @version annotation. test should report if merge going throw optimisticlockexception without trying merge itself. of course go through relations , compare version fields, i'd have more change resistant solution. if adds relation in future test should still work, without adopting.

is there standard way of doing this?

jpa 2.0 have optimistic locking , pessimistic locking.

i think, know optimistic locking main entity below.

enter image description here

i'm looking way find out if detached entity has changed in database?

the below example optimistic locking handling detached entity. using lockmodetype.optimistic_force_increment.

enter image description here


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -