Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7172102

Add method javax.persistence.Query.getSingleResult(Object defaultValue)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 7
    • other-libs
    • x86
    • windows_7

      A DESCRIPTION OF THE REQUEST :
      getSingleResult() throws a NoResultException when no rows are found.

      Please add a
      1. javax.persistence.Query.getSingleResult(Object defaultValue)
      2. javax.persistence.TypedQuery.getSingleResult(X defaultValue)

      JUSTIFICATION :
      The NoResultException when no rows found is a behavior accepted by many but also irritating to many others who would expect a null return value.

      I think adding these method will be a win-win situation and will also add additional functionality of returning a not null default value in case of no rows found.

            darcy Joe Darcy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: