Ian, More information may be needed to figure this out.
What database are you using? What does your schema file look like? You should be able to use the database server's auto incrementing feature properly with Torque. IDBroker should also work. Jmcnally's response in the email you link below is correct. Both should work and you can get the id after an insert/save. We use Sybase with both native and idbroker'd keys, both of which allow us to get the id's after inserting/saving. Something must be config'd wrong. ================================================================= Jeffrey D. Brekke Quad/Graphics [EMAIL PROTECTED] http://www.qg.com > -----Original Message----- > From: Ian Tomkins [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 22, 2002 7:59 AM > To: [EMAIL PROTECTED] > Subject: Problems with torque in TDK 2.1 > > > I am running into some issues with torque the version of > torque in TDK > 2.1, I know there is now a decoupled version and am > contemplating moving > my code over to that. > > However before I dive in it would be nice to know that the > problems I am > experiencing have been fixed in a more recent version. > > There is a problem when I create new Data Objects and then > save them, if > the underlying table uses auto_increment for it's primary key > the Data > Object never gets it's primary key field set. This means that I can't > keep hold of the object and do an update on it later (I am > storing data > objects in a cache for performance reasons (there is a lot of > updating > going on)). > To work around this I have changed my tables to use the > idBroker which > means the primary key field gets correctly set, this mostly > works except > that I have just seen the following exception when calling the save() > method on a data object. > > java.lang.ArrayIndexOutOfBoundsException: 1093626872 > at > java.util.ArrayList.ensureCapacity(ArrayList.java(Compiled Code)) > at java.util.ArrayList.add(ArrayList.java(Compiled Code)) > at > org.apache.turbine.util.db.IDBroker.storeIDs(IDBroker.java(Com > piled Code)) > at > org.apache.turbine.util.db.IDBroker.getNextIds(IDBroker.java(C > ompiled Code)) > at > org.apache.turbine.util.db.IDBroker.getIdAsBigDecimal(IDBroker > .java(Compiled > Code)) > at > org.apache.turbine.om.peer.BasePeer.doInsert(BasePeer.java(Com > piled Code)) > at > net.keyfort.webreport.om.BaseSrcSummaryPeer.doInsert(BaseSrcSu > mmaryPeer.java:134) > at > net.keyfort.webreport.om.BaseSrcSummaryPeer.doInsert(BaseSrcSu > mmaryPeer.java:361) > at > net.keyfort.webreport.om.BaseSrcSummary.save(BaseSrcSummary.java:326) > at > net.keyfort.webreport.om.BaseSrcSummary.save(BaseSrcSummary.java:296) > at > net.keyfort.webreport.om.BaseSrcSummary.save(BaseSrcSummary.java:282) > at > net.keyfort.logprocess.SummaryTable.saveCacheObjects(SummaryTa > ble.java:231) > at > net.keyfort.logprocess.Process.main(Process.java(Compiled Code)) > > I notice that others have seen the primary key problem but I have not > seen any reference to a fix, for example > http://www.mail-archive.com/[email protected]/ms g05719.html Regards, Ian _____________________________________________________________________ Internet Security by Keyfort www.keyfort.co.uk This message has been checked by MessageLabs Virus Scanning Service -- 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]>
