WrongClassException hibEx = (WrongClassException) ex;
return new ObjectRetrievalFailureException(hibEx.getEntityName(), hibEx.getIdentifier(), ex.getMessage(), ex);
}
if (ex instanceof StaleObjectStateException) {
StaleObjectStateException hibEx = (StaleObjectStateException) ex;
return new ObjectOptimisticLockingFailureException(hibEx.getEntityName(), hibEx.getIdentifier(), ex);
}
if (ex instanceof StaleStateException) {
return new ObjectOptimisticLockingFailureException(ex.getMessage(), ex);
}
if (optimisticLockExceptionClass.isInstance(ex)) {
return new ObjectOptimisticLockingFailureException(ex.getMessage(), ex);
}
if (pessimisticLockExceptionClass != null && pessimisticLockExceptionClass.isInstance(ex)) {
if (ex.getCause() instanceof LockAcquisitionException) {
return new CannotAcquireLockException(ex.getMessage(), ex.getCause());
}