Performance Issues when Upgrading OpenJPA to Hibernate - spring

We upgraded from Open JPA -2.4.3 with Spring 4.3.19.RELEASE to Hibernate-
5.4.8.Final with Spring-5.2.6.RELEASE. We had to change ORM provider since spring 5.0 and related Spring Data did not have an OpenJPA vendor adapter. Upgrade caused Performance issues for our Batch Jobs, they were running 10 times slower than before.
We finally ended up migrating the non performing queries to Native SQL Queries.
From performance dumps it Sessions are not being released after the transaction is committed in Hibernate
Question:
Has anyone encounter similar issues and how they resolved it?
One side note, not sure whether its related or not: we have observed is OpenJPA is using OpenJpa is using WeakHashMap and Hibernate is using Concurrent Hashmap.
[1]: https://i.stack.imgur.com/4hE3V.png - Using OpenJPA
[2]: https://i.stack.imgur.com/sXRiw.png - Using Hiberate

Related

Oracle R2DBC query hangs / never completes

I am using Oracle r2dbc in my Spring Boot application.
I have a DatabaseClient set up and when I call:
databaseClient.sql("select ...").fetch().one().block();
The function never returns. It just hangs forever. Why is this?
This happens when using an incompatible version of com.oracle.database.r2dbc:oracle-r2dbc.
Use the 0.1.0 version of Oracle R2DBC if you are programming with
Spring. The later versions of Oracle R2DBC implement the 0.9.x
versions of the R2DBC SPI. Currently, Spring only supports drivers
that implement the 0.8.x versions of the SPI.
https://github.com/oracle/oracle-r2dbc
Be sure to use 0.1.0 and NOT 0.2.0. (Versions 0.3.0 and later will give obscure errors instead of hanging.)
After updating the dependencies in your build system, you may have to invalidate / clear your IDE's cache as well. For Intellij/Maven users, I think the "Reload all Maven projects" button might work too.

Hibernate 5 SQLServerDialect

I've upgraded an application from grails 2 to grails 3. This also meant an upgrade from hibernate 4 to hibernate 5. As the application is deployed on premise in quite few installations, we've used external-config to avoid migrating configurations (from groovy to yaml).
In our current config, we have:
dataSource.dialect = org.hibernate.dialect.SQLServerDialect
However, this doesn't work. Changing this to SQLServer2012Dialect solves the problem, but requires manually changing this on every installation.
Are there any settings (e.g. in hibernate) that solves this issue?
We're using jtds as driver

EHCache with Hibernate Integration Throwing CacheException

I am facing issue in integrating Hibernate And EHCache. I am using Hibernate 3.2.7 GA, Hibernate Annotation 3.2.1 ga,hibernate-commons-annotations 3.2.0.Final, net.sf.ehcache 2.2.0 and Spring version 3.2.4.RELEASE. When I ran my test case I am getting
net.sf.ehcache.CacheException: Error configuring from /content/cache/ehcache.xml. Initial cause was Error configuring from input stream. Initial cause was null:19: Element does not allow attribute "maxEntriesLocalHeap".
In Hibernate config file i have put
true
Please help me to solve the issue. I am new to EHCache.
Fairly confident the 2.2 version of Ehcache doesn't support that maxEntriesLocalHeap. Any reason you're using such an old version?
You either need to use a newer one, or modify your ehcache.xml to comply to the 2.2 XSD

Migrate from Spring 2.5 Native ORM TopLink 10g to JPA

This may be annoying and discussed before but I could not find a good reference which would help to set a direction. I have to plan a migration of TopLink 10g (Spring 2.5 ORM Native Support) to JPA. I need some guidelines (steps) to follow and plan a successful migration.
Let me brief what I have in my technology stack. Primarily, as I mentioned above, application build around Spring 2.5 and Spring 2.5 Native ORM Support of TopLink. Spring 2.5 bundled to support only up to TopLink 10g and if you simply upgrade the TopLink JAR with the latest version it would not work as latest version of TopLink has completely changed the packaging but this still can be tackled by easily find and replace the package names. The main issue is the native api of TopLink ORM in Spring 2.5 which is built around TopLink 10g.
The reason of this migration activity is we cannot upgrade Spring until we migrate data-layer to JPA.
Please share steps if you already achieved something similar in your past or if the above briefing gives you an understanding on the problem you can also drop your opinion on how should I plan this migration.
I am facing a similar migration, toplink10g and Spring 2.5. For the integration we were using as support spring-toplink.jar, but not such support for toplink 12 that actually is the current version. At the moment seems it is not a straight fordward solution but I started first using the renaming tool provided by oracle.
The renaming tool it is necesary since jpa toplink 11 g is provided by eclipselink. You will see all the packages oracle.toplink.* will be renamed by org.eclipse.persistence.*
Did you have any advice othe advices for this migration?

Hibernate OGM & Hibernate OGM first and second level cache

Will Hibernate OGM supports Cassandra? Since OGM provides JPA support to persist data in NoSQL DBs and it reuses Hibernate core engine, what about first and second level cache? Will OGM supports 1st and 2nd level cache?
Yes supporting Cassandra is on the roadmap; there was an experimental first patch already, but then we stopped evolving it as Cassandra's team was heavily updating their Java client API. Development should resume soon, but we depend on contributors.
Roadmap for Hibernate OGM
And yes you can use 2nd level cache as usual: everything except the storage operations are handled by the usual Hibernate ORM code. Of course some concepts might not be available, for example since Cassandra does not support transactions you won't be able to configure a TransactionManager.

Resources