HHH-7861 EntityManager.find() should return null instead of EntityNotFoundException (spaces to tabs)
This commit is contained in:
parent
10defc52cd
commit
fcfecb82b7
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue