I\'ve tried several ways to change the FlushMode to the complete application. Is this right or is there another way to do it?
I don\'t want to do this pragmmatically
Try this
Testing this on a standalone program I can see the changed value of underlying Hibernate Session / EntityManager from AUTO to COMMIT
Here is my persistence.xml
org.hibernate.jpa.HibernatePersistenceProvider
com.test.TestEntity
ENABLE_SELECTIVE
And here is how I test it
EntityManagerFactory emf = Persistence.createEntityManagerFactory("JPATest");
EntityManager em = emf.createEntityManager();
Session session = em.unwrap(Session.class);
System.out.println("Underlying Hibernate session flushmode ####### "+session.getFlushMode());
System.out.println("EntityManager flushmode ####### "+em.getFlushMode());
This gives me
Underlying Hibernate session flushmode ####### COMMIT
EntityManager flushmode ####### COMMIT
If I omit the property in presistence.xml, I get this
Underlying Hibernate session flushmode ####### AUTO
EntityManager flushmode ####### AUTO