users@glassfish.java.net

Re: EJB3 get last Persisted Entity

From: <glassfish_at_javadesktop.org>
Date: Tue, 05 Feb 2008 07:56:20 PST

If I understand the spec correctly, the data is not guaranteed to be written to the data store (or IDs generated) when EntityManager.persist() is called. If you need the ID immediately after, you will need to call EntityManager.flush() to force the persistence provider to write the data to disk, then you should be able to call sucursal.getIdSucursal().
[Message sent by forum member 'jdlee' (jdlee)]

http://forums.java.net/jive/thread.jspa?messageID=257501