>From the Peer HOWTO
(http://jakarta.apache.org/turbine/howto/peers-howto.html)
....
To do an insert we need to add all the fields to the criteria objects. Note
that the id field is not added to the Criteria. It is taken care of by the
ID BROKER. The object that is returned by doInsert is the id of the newly
added row.
Criteria crit = new Criteria();
crit.add (CategoryPeer.NAME,"New Category");
Object o = CategoryPeer.doInsert (crit);
Sean
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
On Behalf Of James Coltman
Sent: Wednesday, June 06, 2001 7:23 AM
To: [EMAIL PROTECTED]
Subject: Help needed with id_broker and foreign keys
Hi,
I use the id_broker to create unique id for each new row. In order to
populate my foreign keys on other tables I need to use this newly created
id. When you create a new row entry how do you find out the id that was
allocated to that entry? Is the only way to do a second select to get back
the newly created row (an id)? I assume someone must have come across this
before. Any help would be much appreciated.
James
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]