You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by lyl <ly...@staff.cn99.com> on 2003/07/28 04:50:21 UTC
How to get last inserted Id
Hi, there.
Can anyone please tell me how to get the id of last inserted record?
I use mysql & OJB in my project, and one of my table's PK is
auto_incremented, when i insert a record i found the PB.store returns
void. Can you tell me how to get the id?
Sincerely.
--
lyl <ly...@staff.cn99.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: How to get last inserted Id
Posted by Eli Anderson <el...@ecaent.com>.
Hello,
You can try to use Identity i.e.
Identity oid = new Identity(obj,broker);
int id = obj.getId();
where broker is a persistence broker and obj is your object to persist.
You can view an explanation of this at:
http://db.apache.org/ojb/sequencemanager.html
On Sun, 2003-07-27 at 21:50, lyl wrote:
> Hi, there.
>
> Can anyone please tell me how to get the id of last inserted record?
> I use mysql & OJB in my project, and one of my table's PK is
> auto_incremented, when i insert a record i found the PB.store returns
> void. Can you tell me how to get the id?
>
>
> Sincerely.
--
Eli Anderson
Ecaent Development