|Re: Exception handling [message #909434 is a reply to message #909062]
||Fri, 07 September 2012 06:13
| Andreas Bohnert
Registered: September 2012
thanks for quick response!
very strange. why they use runtime exceptions?
according to oracle:
"One Exception subclass, RuntimeException, is reserved for exceptions
that indicate incorrect use of an API"
maybe in case of getSingleResult it is debateable, but if they use
runtime exceptions for the entire jpa api I wonder why they change the
concept of using exceptions.
even in a enterprise environment where you may have managed transactions
they could have implement normal exceptions.
So, if you want to respond to issues which may happen on the database
side, you are supposed to catch the runtime exception, right?
James Sutherland schrieb:
> getSingleResult() does throw these exceptions. They are
> RuntimeExceptions (as all exceptions in JPA), so you are not required to
> catch them, and may not see them in the throws clause.
> They will be thrown if your query returns nothing, or multiple rows.
Powered by FUDForum
. Page generated in 0.05966 seconds