Uploaded image for project: 'Solder'
  1. Solder
  2. SOLDER-41

add getSingleResult() to PropertyQuery

    Details

    • Type: Feature Request
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 3.0.0.Beta1
    • Component/s: None
    • Labels:
      None
    • Affects:
      Documentation (Ref Guide, User Guide, etc.)
    • Estimated Difficulty:
      Low

      Description

      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#getSingleResult()

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                dan.j.allen Dan Allen
                Reporter:
                dan.j.allen Dan Allen
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: