[jboss-user] [EJB 3.0] - cannot control when flush/commit occurs

lpmon do-not-reply at jboss.com
Wed May 21 17:14:34 EDT 2008

JBoss AS 4.0.5
Seam 1.2.1
MySql 5.1
Seam Injected entitymanager

I need to add a new row and read back the auto-assigned primary key. I can tell the record is not really commited to the DB even after flush is called. It looks like it is being committed when the method exits.  What is the purpose of flush if it not to commit to the DB?  How can I force an immediate commit?  It is a JTA so getTransaction().commit() cannot be used.

        entityManager.persist( myEntity);

        int pk = myEntity.getPk();  // returns 0

I tried entityManager.refresh(myEntity) and it throws an entitynotfound exception.  

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152490#4152490

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4152490

More information about the jboss-user mailing list