Search code examples
javajpaeclipselinkderbyentitymanager

speed up the commit of the entity manager for 3000 recordes


Im having 3 entities each entity with 5 members string and I want to persist 1000 records for each entity . when I did performance testing the entitymanager.commit() takes about 1.1 seconds , I think this is too much time... there is a way to speed up the commit of the entity manager?

I'm using Derby DB with eclipse link.


Solution

  • You gain most by enabling batching, but there are also other optimizations that you should consider. You can enable batching by setting following property for your persistence unit in persistence xml: "eclipselink.jdbc.batch-writing"="JDBC".

    I recommend reading article at http://java-persistence-performance.blogspot.fi/2011/06/how-to-improve-jpa-performance-by-1825.html