db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.win...@telenet-ag.de
Subject Re: updating autoincrement value after save
Date Wed, 18 May 2005 05:07:20 GMT
Hi Thomas,

thanks for your answer.

I have set the idmethod to "none" because I get some exceptions that 
IdBroker is not probably initialised
if I set the IdMethod to "native" or "autoIncrement". Maybe that's the 
cause I didn't get the ID ?!?

I tried several things to initialise that IdBroker, but nothing helps. To 
my understanding, I don't need this
IdBroker, because mySQL does the autoincrement for me. Or am I wrong ?

Until now, I have not tried to debug the Torque code. If I have some time 
this week, I will try.

Arndt





Thomas Fischer <tfischer@apache.org>
10.05.2005 21:09
Please respond to "Apache Torque Users List"

 
        To:     Apache Torque Users List <torque-user@db.apache.org>
        cc: 
        Subject:        Re: updating autoincrement value after save


Hi Arndt,

I could not reproduce your problem using the current cvs version.
I have used the bookstore-schema from the runtimetest:

<database
   name="bookstore"
   defaultIdMethod="native">
...
   <table name="author" description="Author table">
     <column
       name="author_id"
       required="true"
       primaryKey="true"
       type="INTEGER"
     />
...

and the author id is not zero after a save (note that in cvs, primary 
keys are autoincrement by default)
However, this does not mean that this problem could not exist in Torque 
3.1.x, as Henning has done some garbage collection in the id generation 
code.

Have you tried to debug into Torque code and see what happens ?

     Thomas


On Fri, 6 May 2005 a.winter@telenet-ag.de wrote:

> Hi torque-users,
>
> I'm trying to get the primary key (generated by the databses using
> autoincrements)
> after saving my object, but the id of the object is 0.
>
> object.save()
> object.getId() ---> 0
>
> If I select the object after saving it, I get the correct value.
>
> object.save()
> object = ObjectPeer.doSelect(...)
> object.getId() ---> 4711
>
> Im Using Torque 3.1.1 with MySql 4.1.1.
> What can I do to get the id without selecting the object again.
>
> Thanks for your answers,
> Arndt
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message