ExceptionConverter throws an exception if the Proxy is no longer reachable

Description

The ExceptionConverter tries to adapt the StaleStateException to an OptimisticLockException. Because the OptimisticLockException can also take an entity, we have the following logic:

1 2 3 4 5 6 7 8 9 final Object entity = sharedSessionContract.load( sose.getEntityName(), identifier, false, true); if ( entity instanceof Serializable ) { //avoid some user errors regarding boundary crossing pe = new OptimisticLockException( e.getMessage(), e, entity ); } else { pe = new OptimisticLockException( e.getMessage(), e ); }

The load method tries to load a Proxy, and if the Proxy is no longer reachable (maybe it was removed intentionally), then this method call throws an ObjectNotFoundException, therefore masking the OptimisticLockException.

Environment

None

Status

Assignee

Vlad Mihalcea

Reporter

Vlad Mihalcea

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.0

Priority

Major
Configure