We should refactor code that calls getSingleResult() to getResultList() where the NoResultException is caught and it's ok if there is no result. See https://stackoverflow.com/questions/24045342/why-jpa-uses-javax-persistence-noresultexception
If the NoResultException is not caught directly in the method it can unintentionally lead to transaction rollbacks. See: http://glassfish.10926.n7.nabble.com/Unexpected-Behavior-NoResultException-rolls-back-transaction-td20819.html
I'm not sure what the best way to refactor it is:
We should refactor code that calls
getSingleResult()togetResultList()where the NoResultException is caught and it's ok if there is no result. See https://stackoverflow.com/questions/24045342/why-jpa-uses-javax-persistence-noresultexceptionIf the NoResultException is not caught directly in the method it can unintentionally lead to transaction rollbacks. See: http://glassfish.10926.n7.nabble.com/Unexpected-Behavior-NoResultException-rolls-back-transaction-td20819.html
I'm not sure what the best way to refactor it is:
Today the NoResultException is automatically mapped to a 404. See REST AMW_rest/resources/resources/{resource}/lte/{RL} http 500 instead of 404 #421