[hibernate-dev] Wrapping of optimistic exceptions
Christian Bauer
christian.bauer at gmail.com
Fri Nov 9 20:22:19 EST 2012
I've noticed some cases where a native Hibernate exception is not wrapped in a javax.persistence.OptimisticLockException.
EntityVerifyVersionProcess.java throws an org.hibernate.OptimisticLockException that is passed on directly to JPA users.
EntityIncrementVersionProcess.java passes through the org.hibernate.StaleObjectStateException from AbstractEntityPersister#forceVersionIncrement() without wrapping. If wrapping in JPA isn't possible, at least this one should be wrapped in an o.h.OptimisticLockException for consistency sake.
Are JPA users expected to catch all three exceptions when using versioning? Is OptimisticEntityLockException useful?
More information about the hibernate-dev
mailing list