I am working on an Web-Application which is in productive use for about 17 years. Currently it's using Vaadin 23 and EclipseLink 2.7.8. After the end of the support for Vaadin 23 it is necessary to update to Vaadin 24, which needs SpringBoot 3. This seems to cause a need to change the Java Persistence API from 2.1 (javax.persistence) to 3.x. (jakarta.persistence) as well.
The problem: The JUnit-Tests take about 10 Minutes to run with EclipseLink 2.7.8. Changing nothing but Eclipselink to 2.7.9 increases the runtime up to 20 Minutes. Changing to 2.7.14 increases to 30 Minutes. And with 3.0.4 the tests take 40 Minutes at least. The Application slows down accordingly.
It seems, that simple selects ("select o from YXZ o") are causing the rising of the runtime. All list dependencies (@OneToMany) are annotated as "fetch = FetchType.LAZY" explicitly, although this should be default.
As a workaround I tried to keep Eclipselink 2.7.8 with SpringBoot 3. Compilation and starting Test-Cases worked at last. The properties could been read from persistence.xml but the @Entity Classes are not recognized by the EntityManager.
Has anyone an idea how to fix this or is there a way for making the workaround to keep Eclipselink 2.7.8 working?
I made an special JUnit-Testcase to demonstrate the problem. A simple "select all" on 5 Entities / Tables:
EntityManager em = Persistence.createEntityManagerFactory(Constants.PERSISTENCE_UNIT).createEntityManager();
String format = "%-20s: %6d %8d \n";
System.out.printf("%-20s: %6s %8s \n", "Entity", "Count", "Duration");
long start = System.currentTimeMillis();
String[] entities = {"Enity1", "Enity2", "Enity3", "Enity4", "Enity5"};
for (String entity: entities) {
String query = String.format("select o from %s o", entity);;
long sStart = System.currentTimeMillis();
int size = em.createQuery(query).getResultList().size();
System.out.printf(format, entity, em.createQuery(query).getResultList().size(), System.currentTimeMillis() - sStart);
}
System.out.println("Duration summary:" + (System.currentTimeMillis() - start));
Results:
EclipseLink 2.7.8:
| Entity | Count | Duration |
|---|---|---|
| Entity1 | 3448 | 328 |
| Entity2 | 1224 | 560 |
| Entity3 | 1427 | 533 |
| Entity4 | 9407 | 3172 |
| Entity5 | 23548 | 8970 |
Duration summary:13565
EclipseLink 2.7.9:
| Entity | Count | Duration |
|---|---|---|
| Entity1 | 3448 | 465 |
| Entity2 | 1224 | 5187 |
| Entity3 | 1427 | 5834 |
| Entity4 | 9407 | 40513 |
| Entity5 | 23548 | 114871 |
Duration summary:166872
Althogh there must be more issues causing the runtime increase over the versions (write access), the main problem is the dramatic runtime increase to access the table contents from version 2.7.8 to version 2.7.9.