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

retrieveByPK throws TorqueException instead of NoRowsException when it can't find a primary key.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0
    • 5.0
    • None
    • None

    Description

      I have the following in my schema.xml:
      <table name="read" idMethod="none">
      <column name="userRef" primaryKey="true" required="true" type="INTEGER" />
      <column name="entryId" primaryKey="true" required="true" type="INTEGER" />
      <column name="entryType" primaryKey="true" required="true" type="INTEGER" />
      <column name="readTime" type="TIMESTAMP" required="true" />
      </table>

      Which then generate the following code in my Peer class.
      /**

      • retrieve object using using pk values.
        *
      • @param juusuuserref int
      • @param entryid int
      • @param entrytype int
      • @param con Connection
        */
        public static Juusuread retrieveByPK(
        int juusuuserref,
        int entryid,
        int entrytype,
        Connection con) throws TorqueException
        {
        ....
        }

      But this retrieveByPK will throw a
      TorqueException("Failed to select one and only one row.")
      instead of a NoRowsException as expected if it can't find a entry in the database.

      Attachments

        Activity

          People

            tfischer Thomas Fox
            tiller Martin Tilsted
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: