0 Replies Latest reply on May 21, 2008 5:14 PM by lpmon

    cannot control when flush/commit occurs

    lpmon Novice

      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.