HHH-7861 EntityManager.find() should return null instead of EntityNotFoundException (spaces to tabs)

This commit is contained in:
Scott Marlow 2013-01-24 22:14:26 -05:00
parent 10defc52cd
commit fcfecb82b7
1 changed files with 10 additions and 10 deletions

View File

@ -887,16 +887,16 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
return ( A ) getSession().get( entityClass, ( Serializable ) primaryKey );
}
}
catch ( EntityNotFoundException ignored ) {
// DefaultLoadEventListener.returnNarrowedProxy may throw ENFE (see HHH-7861 for details),
// which find() should not throw. Find() should return null if the entity was not found.
if ( LOG.isDebugEnabled() ) {
String entityName = entityClass != null ? entityClass.getName(): null;
String identifierValue = primaryKey != null ? primaryKey.toString() : null ;
LOG.ignoringEntityNotFound( entityName, identifierValue );
}
return null;
}
catch ( EntityNotFoundException ignored ) {
// DefaultLoadEventListener.returnNarrowedProxy may throw ENFE (see HHH-7861 for details),
// which find() should not throw. Find() should return null if the entity was not found.
if ( LOG.isDebugEnabled() ) {
String entityName = entityClass != null ? entityClass.getName(): null;
String identifierValue = primaryKey != null ? primaryKey.toString() : null ;
LOG.ignoringEntityNotFound( entityName, identifierValue );
}
return null;
}
catch ( ObjectDeletedException e ) {
//the spec is silent about people doing remove() find() on the same PC
return null;