org.hibernate.ejb.Query.getSingleResult() throws
Code:
javax.persistence.NoResultException
if the requested entity is not found.
The specification says it should throw
Code:
javax.persistence.EntityNotFoundException
See
http://www.hibernate.org/hib_docs/ejb3- ... gleResult()
The source for the method looks like this:
Code:
public Object getSingleResult() {
try {
Object result = query.uniqueResult();
if ( result == null ) {
throw new NoResultException( "No entity found for query" );
}
return result;
}
catch (NonUniqueResultException e) {
throw new javax.persistence.NonUniqueResultException( e.getMessage() );
}
}
Will this be changed, or should I change my code to catch the incorrect exception, and it will work forever?