add getSingleResult() to PropertyQuery
--------------------------------------
Key: WELDX-177
URL:
https://jira.jboss.org/browse/WELDX-177
Project: Weld Extensions
Issue Type: Feature Request
Affects Versions: 1.0.0.Beta1
Reporter: Dan Allen
Fix For: 1.0.0.Beta2
PropertyQuery should offer the method getSingleResult() for the same reason it exists in
the JPA Query interface: to fetch a single result but also assert that there is only one
result to be fetched. If more than one property is matched when getSingleResult() is
called, an exception will result.
Using getFirstResult() to return exactly one result is inappropriate (and could lead to
bugs) because it could hide the fact that multiple properties are being inadvertently
matched. As a workaround, the developer would currently have to run getResultList() to
ensure only one property matches. Offering a getSingleResult() would resolve these
issues.
See
http://download.oracle.com/javaee/6/api/javax/persistence/Query.html#getS...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira