i had the same pb on mySQL where you get the id after the insert (select last_insert_id() from MyTable), I tried to update the EJB Primary Key on the ejbPostCreate method (ejbCreate was generated by the container) but it was to late for the container (I got duplicateKeyException). any idea? Jean-Noel -----Ursprüngliche Nachricht----- Von: Maraya Michael [mailto:[EMAIL PROTECTED]] Gesendet: Donnerstag, 26. Juli 2001 17:50 An: '[EMAIL PROTECTED]' Betreff: RE: [JBoss-user] Auto Incrementing Primary Key with PostgreSQL a nd JBoss I don't use Postgres but on MS SQL Server, I call "SELECT @@IDENTITY" immediately after the insert statement. Perhaps this will lead you in the right direction. --- Michael R. Maraya > ---------- > From: Federico Vesco[SMTP:[EMAIL PROTECTED]] > Reply To: [EMAIL PROTECTED] > Sent: Thursday, July 26, 2001 11:06 AM > To: [EMAIL PROTECTED] > Subject: [JBoss-user] Auto Incrementing Primary Key with PostgreSQL > and JBoss > > > How may i obtain the value of the primary key generated by PostgreSQL ( i > > need to obtain this value because i have to return the primary key value) > ? > I thougth I migth obtain it with a simple select query, but in this way > i'm > not sure the value I obtain is exactly the one needed (by definition, only > > the primary key identifies univokely a record). > Any suggestion? How can i manage this situation? Do you think I have do > change my program? > > _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user