Change getSingleResult by Hk-tang · Pull Request #460 · javaee-samples/javaee7-samples
Repository navigation
Change getSingleResult - #460
Open
Hk-tang wants to merge 1 commit into javaee-samples:master from Hk-tang:fix-potential-exception
Open
Change getSingleResult #460 Hk-tang wants to merge 1 commit into javaee-samples:master from Hk-tang:fix-potential-exception
Conversation
Hk-tang commented Mar 23, 2020 · edited Loading
Copy link Copy Markdown
query.getSingleResult() causes an exception could be thrown if there is not exactly one row returned.
Although this commit does not implement logic on how to decide which result in the result list should be taken, this removes the potential exception/need for a try/catch. Implementation on how to decide which result to take should be made per context.
getSingleResult causes exceptions if anything other than one result r...
d14a55b
...eturnedSign up for free to join this conversation on GitHub . Already have an account? Sign in to comment