I have never used the autoincrement=true attribute on a column.  I am
pretty sure the column to autoincrement is always the pk column.  I
suppose someone will give some reason it could be a non-pk column or
that there are multiple pk columns one or more of which could be the
autoincrement column.  But I think torque will fall down on these type
of systems anyway.

john mcnally

"Brekke, Jeff" wrote:
> 
> I think these are correct for MySql, give em a try.  You'll need to specify
> which col to autoincrement in all cases in the <column/>.
> The idMethod is different in 2.2b1 and decoupled torque.
> 
> For idbroker:
> 
> <table name="log_entry" idMethod="idbroker">
>    <column name="log_entry_id" required="true" primaryKey="true"
> autoincrement="true" type="INTEGER"/>
>    -- SNIP (remove columns and indexes) --
> </table>
> 
> For native increment with 2.1:
> 
> <table name="log_entry" idMethod="autoincrement">
>    <column name="log_entry_id" required="true" primaryKey="true"
> autoincrement="true" type="INTEGER"/>
>    -- SNIP (remove columns and indexes) --
> </table>
> 
> For native with 2.2b1 or jakarta-torque:
> 
> <table name="log_entry" idMethod="native">
>    <column name="log_entry_id" required="true" primaryKey="true"
> autoincrement="true" type="INTEGER"/>
>    -- SNIP (remove columns and indexes) --
> </table>
> 
> =================================================================
> Jeffrey D. Brekke                                   Quad/Graphics
> [EMAIL PROTECTED]                              http://www.qg.com
> 
> > -----Original Message-----
> > From: Ian Tomkins [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, February 22, 2002 8:40 AM
> > To: Turbine Users List
> > Subject: Re: Problems with torque in TDK 2.1
> >
> >
> > I am using mysql.
> >
> > All the tables in my current schema look like this
> >
> >   <table name="log_entry" idMethod="idbroker">
> >     <column name="log_entry_id" required="true" primaryKey="true"
> > type="INTEGER"/>
> >  -- SNIP (remove columns and indexes) --
> >   </table>
> >
> > They used to look like this
> >
> >   <table name="log_entry">
> >     <column name="log_entry_id" required="true" autoIncrement="true"
> > primaryKey="true" type="INTEGER"/>
> >  -- SNIP --
> >   </table>
> >
> >
> > Brekke, Jeff wrote:
> >
> > >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]>
> >
> >
> >_____________________________________________________________________
> >Internet Security by Keyfort  www.keyfort.co.uk
> >This message has been checked by MessageLabs Virus Scanning Service
> >
> 
> _____________________________________________________________________
> 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]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to