if (ex instanceof ObjectDeletedException) {
return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
}
if (ex instanceof UnresolvableObjectException) {
UnresolvableObjectException hibEx = (UnresolvableObjectException) ex;
return new ObjectRetrievalFailureException(hibEx.getEntityName(), hibEx.getIdentifier(), ex.getMessage(), ex);
}
if (ex instanceof WrongClassException) {
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);
}