Hibernate 5.2.18 compatibility issue

We have upgraded the spring security web to 5.5.1 version. As part of solving the compatibility issues, we had to upgrade hibernate as well., to version 5.2.18.

This caused additional issues with hazelcast and hence upgraded the jar to hazelcast-hibernate52 - 1.3.0 (also tried with 1.3.3), as our hazelcast version is 3.8.6.

Now certain operations are throwing the following error:
“com.hazelcast.nio.serialization.HazelcastSerializationException: java. io. InvalidClassException: org hibernate.cache.spi.entry.StandardCacheEntryImpl; local class incompatible: stream classdesc serialVersionUID…”
hence failing to commit the transaction.

Please find the configuration summary:
Hibernate - Upgraded from 5.0.5.Final to 5.2.18
Hazelcast - 3.8.6 - No change
Hazelcast-hibernate - Upgraded from hazelcast-hibernate5 1.2.0 to hazelcast-hibernate52 1.3.0 (tried with 1.3.3 as well)
spring core,aop,beans,orm,tx etc - Upgraded from 5.0.8.Release to 5.3.8

While comparing the class StandardCacheEntryImpl in hibernate 5.2.18 and 5.0.5, the field lazyPropertiesAreUnfetched is removed. Besides, it is stated that the lazy fetch type is deprecated. Can this cause any inconsistency in the cached resource and hence the above error!

We have tried flushing the L2 cache as well, still the same behavior.

I don’t know much about hazelcast, so it might be better to ask this in the forum of hazelcast as well. When you are saying the transaction fails, this sounds a bit to me as if the receiver of the serialized stream can’t deserialize it properly because the receiver (a hazelcast cache server?) still uses the old version. Either way, AFAICS this is not something we can help you with and your question should be directed to the hazelcast team.

The above issue got resolved after putting the upgraded jars in hazelcast cache server. But this introduced a new error stating : “Caused by: com. hazelcast. core. HazelCastException: java. lang. NoClassDefFoundError: javax/persistence/EntityManager”

Are the versions causing the trouble? As EntityManager belongs to the hibernate-jpa jar, confused about this error being thrown from hazelcast.

I don’t know which JARs you are adding to your server, but from the error message, I can only deduce that there is no JAR on the classpath containing the JPA interfaces.

@beikov We have hibernate core 5.2.18 and hazlecast-hibernate52 - 1.3.0 in the hazelcast server. I believe the implementations are provided from hibernate core. Please advice.

Well, the JPA classes are not part of hibernate-core. They are part of e.g. this archive

@beikov Completely agrees with you, i meant the implementations for entitymanager in my reply.

We haven’t done any changes apart from upgrading the hibernate core and hazelcast-hibernate jar in the hazelcast server.

With Hibernate 5.2 we moved away from the separate artifact for the JPA implementation, so it is expected that you need a new JAR now since the dependencies of hibernate-core changed. Also see: hibernate-orm/migration-guide.adoc at 5.2 · hibernate/hibernate-orm · GitHub

@beikov So which is the new jar we need to add to hazelcast server? is it the hibernate-jpa 2.1 ? I cant find the expected details in the provided link. Please help with the same.

We already have the hibernate 5.2.18 and hazelcast-hibernate52 - 1.3.0 in the hazelcast server.

Yes, that will probably fix the error you are experiencing. Apart from that, I can’t help you any further. Contact your Hazelcast representative about this issue if you need further assistance. This is not a Hibernate issue.

@beikov Thank you for the response.