Is the key available in the row that inserted into the database when you call em.flush() ? You mention that sometimes the value is populated and sometimes it is not. What is the difference in the environment or the operations between those times?
--Gordon
[Message sent by forum member 'gyorke' (gyorke)]
http://forums.java.net/jive/thread.jspa?messageID=233844