Answering my own question

It turns out... when I save an existing object I must flush the entity
manager before persisting. On creating I should not flush. 

    public final void create(Object o) {
        getEntityManager().getTransaction().begin();
        getEntityManager().persist(o);
        getEntityManager().getTransaction().commit();
    }
    
    public final void update(Object o) {
        getEntityManager().getTransaction().begin();
        getEntityManager().persist(o);
        getEntityManager().flush();
        getEntityManager().getTransaction().commit();
    }

In the past I was using the create method (called save at the time) for
updating and saving.

Thanks
-- 
View this message in context: 
http://n2.nabble.com/Locking-Exception-after-Persisting-new-entity-tp3992010p3992165.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to