1. Torque
  2. TORQUE-69 may not work if there is no primary key but no error is thrown.


    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 3.3-RC3
    • Component/s: Runtime
    • Labels:
    • Environment:
      WinXP / Java 1.5 / Tomcat 5.5 / MS SQL


      Here's the situation.

      You have a table with no primary key. E.g. A table named Poor_Design with columns: FK1, FK2, Value1, Value2.

      You then retrieve a record object from that table, modify it, and then save it, e.g.

      Criteria c = new Criteria();
      c.add(PoorDesignPeer.FK1, fk1);
      c.add(PoorDesignPeer.FK2, fk2);
      List result = PoorDesignPeer.doSelect(c);

      PoorDesign modifiedRec = (PoorDesign) results.get(0);


      The save() ( UPDATE ) to the DB will not suceed, but no error will be thrown indicating it failed.

      This also occur if PoorDesignPeer.doUpdate(modifiedRec) is used.

      This condition should probably throw an error in all cases, since there is no reliable way to locate the original record in the DB.

      In trying to trace it out, I suspect that there is probably some logic bug in the underlying BasePeer object. This is probably related to the buildcriteria(object) not being able to identify modified fields from unmodified and therefore
      creating a criteria for a record that can't be retrieved again at lower levels. But the logic for this is complicated.

      However, an easy way to fix this might be to just update the generated peer's doUpdate( object ) method to check for primary keys or not, and throw an exception here all the time.


        Thomas Fox made changes -
        Field Original Value New Value
        Fix Version/s 3.3-RC3 [ 12312398 ]
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        CG Monroe created issue -


          • Assignee:
            CG Monroe
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: