Skip to content Skip to sidebar Skip to footer

Persistence.createEntityManagerFactory Takes Ages

I have a DBUnit test which runs OK, but is taking ages (4-5 mins) to create the entity manager factory. I am using JPA with hibernate and SQL serve. Would be of great help if anybo

Solution 1:

Finally managed to bring down the EntityManagerFactory operation time from around 255 seconds to about 3 seconds on an average. Upgraded the hibernate-entitymanager from 3.4.0.GA to 3.6.3.Final and voila! Unit test runs like a unit test now, just under 6 secs. Will try to seeek an answer for this improvement for my knowledge.


Solution 2:

I would recommend you trying to find where the bottleneck is by:

1-Connecting to the SQLServer using a terminal.

2-Modifying the connection to link to a different database (MySQL, PostgreSQL, H2,...).

If both run smoothly, then the problem is in your configuration, and I can't help you any further, as long as I am not quite experienced with JPA.


Post a Comment for "Persistence.createEntityManagerFactory Takes Ages"