This should be simple. I need to understand what I am missing. I cannot read back the primary key (pk)after calling persist. I can see the row in the DB with the primary key that was auto-assigned by MySql.
JBoss AS 4.0.5 w/EJB3
Seam 1.2.1 w/conversation scoped entitymanager
int pk = theEntity.getPk()
(what the heck: I has to escape the equal sign above or the text is rejected in the topic editor)
Tried refresh(theEntity) which fails with an EntityNotFoundException (presumably because its pk is zero and refresh needs to know the pk).
Of note. It looks like the row is not actually flushed to the DB when flush is called. It looks like it occurs when the control is returned to the view meaning the entire call stack started by the action exits.
I use Seam Managed entityManager (works much better than EJB3
persistentContext) and use a merge operation within a conversation scoped SFSB (where a save method is not the end of the conversation)
foo.getId() // should give you the id
It automatically flushes and refreshes foo in this case.