Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] javax.persistence.NoResultException

Hi Tim,

It is on a JPA named query.

Leon

Tim Hollosy wrote:
Is that on a native query or a JPQL query?

I don't get it on a native query, I'd like to know when that exception
is thrown though, in the mean time you could always catch the
RuntimeException.

/tim

On Wed, May 14, 2008 at 12:03 PM, Leon Derks <leon.derks@xxxxxxxxxx> wrote:
Hello

I did get the following exception:
javax.persistence.NoResultException: getSingleResult() did not retrieve any
entities.

This exception is correct, because there was nu such object in the db.
But if the object doesn't exist, I want to return a null object and not a
NoResultException

Is there a way how I can do that?

Leon


 _______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users







Back to the top