O'Reilly logo
  • Gangadhara Melukote thinks this is interesting:

Although getSingleResult() is convenient to use, be sure that the query and its possible results are well understood; otherwise application code may have to deal with an unexpected runtime exception. Unlike other exceptions thrown by entity manager operations, these exceptions will not cause the provider to roll back the current transaction, if there is one.


Cover of Pro JPA 2, Second Edition


Transaction will not roll back for getSingleResult() exceptions.