Uploaded image for project: 'Torque'
  1. Torque
  2. TORQUE-200

Generate methods in Peer classes to retrieve a single object from a table

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0-beta1
    • Component/s: Templates
    • Labels:
      None

      Description

      Often, one knows that a database query will return at most a single object.
      To get that object, the following code is needed:
      List<Book> bookList = BookPeer.doSelect(criteria);
      Book book = null;
      if (bookList.size > 1)
      {
      throw new TooManyRowsException("...");
      }
      if (!bookList.isEmpty())
      {
      book = bookList.get(0);
      }

      There should be methods named doSelectSingleRecord(...) generated in the Peer class which contains teh above code.

        Attachments

          Activity

            People

            • Assignee:
              tfischer Thomas Fox
              Reporter:
              tfischer Thomas Fox
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: