An interesting update. The problem lies in the fact that the table only consists of two foreign keys.
The code in buildCriteria() will NEVER add the values for an insert because both table entries are listed as primaryKeys, which in the generated code only get added to criteria on an update. However, one cannot simply not list the columns as primary keys, as this generates compile errors. What's the correct solution to this problem that does not involve always editing the BaseXXXPeer class? -Andrew -----Original Message----- From: Andrew [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 12:22 PM To: Torque Users List (E-mail) Subject: Bizarre error inserting a new row (Torque claims that there's no data to insert) This is happening, currently, to one of my tables. I am doing: ConversationMessageDO om = new ConversationMessageDO(); om.setMessageID("1"); om.setConversationID("2"); om.save(); Those two fields are the only rows on this column. This is an intersect table, and both rows point to other tables, if that helps. When I try to do this I get the following exception thrown at me: org.apache.torque.TorqueException: Database insert attempted without anything sp ecified to insert at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:839) at com.uniti.db.om.BaseConversationMessageDOPeer.doInsert(BaseConversati onMessageDOPeer.java:152) at com.uniti.db.om.BaseConversationMessageDOPeer.doInsert(BaseConversati onMessageDOPeer.java:417) at com.uniti.db.om.BaseConversationMessageDO.save(BaseConversationMessag eDO.java:376) at com.uniti.db.om.BaseConversationMessageDO.save(BaseConversationMessag eDO.java:341) at com.uniti.db.om.BaseConversationMessageDO.save(BaseConversationMessag eDO.java:324) I spent a good deal of time perusing the source code to find out whats up. The last line called in BaseConversationMessageDOPeer calls doInsert on the BasePeer class, as you can see from the trace. The parameters it passes are a Criteria and DBConnection. The interesting bit is that the Criteria seems to be completely empty. Why? Because in buildCriteria() it only ads information to the criteria object if the object is not new. Well the object is of course new since we are doing an insert. Anyone know whats up with this? This doesn't seem to happen with all classes. I am most perplexed. Thanks. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
