From: "Pugh, Eric" <[EMAIL PROTECTED]>
> I read/searched around, and it seems that when you do the insert in the
save
> method of the BasePeer, you should get an object back with the primary
key.
> However, I get a null, which I think is because my idMethod is none.
> Therefore after the insert, Torque has no idea what the primary key was,
> because it is an identity column.

I totally missed that you said your idMethod was "none".  With "none" how
would you expect an id to be generated?  How does the id get assigned to
the original object?

Assuming you are using tdk2.1 why not set idMethod to "autoincrement"
and let the database allocate the ids for you.  I much prefer
"autoincrement"
over "idbroker" as it allows you to create records external to your
application.

>
> I ended up doing a custom executeQuery: Select max(product_id) from
> products.  However this does raise the issue that if two people do two
> inserts at the same time, they might both get the same product id back!

I assume idBroker takes steps to prevent this.  "autoincrement" should
handle this also.

> I will try the setNew.  What does that actually do (other then tell torque
> that its needs to do an insert)?  Also, I think doing the copy causes the
> setNew(true) to happen.

Yes, it tells torque to do an insert.  Copy may well set the new flag.
Ultimately my comment was misdirected because I skipped over
your idMethod.

> Eric

Cheers,

Scott


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

Reply via email to