Skip to content

Refactor getSingleResult() to getResultList() #536

@yvespp

Description

@yvespp

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions