Speed Up Your JPA Transactions
Why don't you subscribe to my blog while you're here? I'm a freelance web developer and I blog about Ruby, Rails, and business online.
Go ahead and subscribe to my RSS feed. Thanks for visiting!
JPA is a new standardized Java persistence system that takes the best parts of the current persistence technologies. Recently while using JPA, I had noticed that large transactions took increasingly longer to process. It turned out that by default, JPA cross checks a pending query with all managed entities to ensure that the query is up to date. To disable this default behaviour and shoulder the object management yourself, you can do the following:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("YOUR_PU");
EntityManager em = emf.createEntityManager();
em.setFlushMode(FlushModeType.COMMIT); // disable auto-management