I’m using OpenJPA and want to configure it to use Autocommit on every write/insert operation.
At the moment I have to do this:
MyEntity e = new MyEntity();
em.getTransaction().begin();
em.persist(e);
em.getTransaction().commit();
What I want to be able to do is this:
MyEntity e = new MyEntity();
em.persist(e); // auto commit here
I have this property set to true:
openjpa.NontransactionalWrite : true
Any clues?!
You can’t auto-commit with JPA. If you want to remove the local transaction management, use JTA/CMT or Spring managed transactions.