If you're using BMP, you can issue two SQL statements from within
ejbCreate().  Make the first statement the INSERT statement and the second
should be the SELECT last_insert_id().  I don't know how this would work for
CMP, though.

---
Michael R. Maraya

> ----------
> From:         Jean-Noël Heyraud[SMTP:[EMAIL PROTECTED]]
> Reply To:     [EMAIL PROTECTED]
> Sent:         Thursday, July 26, 2001 12:34 PM
> To:   '[EMAIL PROTECTED]'
> Subject:      AW: [JBoss-user] Auto Incrementing  Primary Key with
> PostgreSQL a nd JBoss
> 
> 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
> 
> 

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to