If I call <table>.save for insert/update, it works, but calling <table>Peer.doInsert/doUpdate fails with "No changes to save". Since Torque translates a <table>.save into a Base<table>Peer.doInsert/doUpdate with a Criteria object, I must be doing "something" wrong when I construct the Criteria object, but it looks like I'm doing the same as in the Base<table>Peer.buildCriteria method. Is there anything else I need to do with the Criteria object, other than set the columns and key ?
On Saturday 24 August 2002 9:48 am, Peter White wrote: > Can somebody please tell me what I'm doing wrong here. Queries work fine, > but Inserts/Updates fail with "No changes to save" thrown from > "BasePeer.insertOrUpdateRecord(BasePeer.java:1034)". I'm using b3 against > postgres. The database was already created and working. I generated the > schema manually (couldn't get Torque to do it). Sequences/autoincrement > work ok in db console (or non-torque code). > > <mycode> > > My schema (snippet): > > <table name="mytable" javaName="MyTable" idMethod="native"> > <column name="myid" required="true" primaryKey="true" autoIncrement="true" > type="INTEGER" /> > <column name="mydescription" required="true" type="VARCHAR" size="50" /> > <id-method-parameter value="mytable_myid_SEQ"/> > > The code (snippet) for Insert: > > Criteria actionCrit = new Criteria(); > actionCrit.add(myPeer.MYDESCRIPTION, "this is a test"); > myPeer.doInsert(actionCrit); > > The code (snippet) for update: > > Criteria actionCrit = new Criteria(); > Criteria selectCrit = new Criteria(); > String myidvalue = "1"; > actionCrit.add(myPeer.MYDESCRIPTION, "this is another test"); > selectCrit.add(myPeer.MYID, myidvalue); > myPeer.doUpdate(selectCrit,actionCrit); > > </mycode> > > Please advise if you can, I'm stuck! > > Pete -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
