0

I am using Hibernate OGM 5.1.0.Final and hazelcast-hibernate5 1.1.3 ( even checked with 1.2 ). The OGM compatible hibernate ORM dependency is 5.1.5 , which is present in POM.

Caused by: java.lang.IncompatibleClassChangeError: Expected static method org.hibernate.cache.internal.DefaultCacheKeysFactory.createEntityKey(Ljava/lang/Object;Lorg/hibernate/persister/entity/EntityPersister;Lorg/hibernate/engine/spi/SessionFactoryIm
    at com.hazelcast.hibernate.region.EntityRegionAccessStrategyAdapter.generateCacheKey(EntityRegionAccessStrategyAdapter.java:66)
    at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:198)
    at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:125)
    at org.hibernate.ogm.loader.impl.OgmLoader.initializeEntitiesAndCollections(OgmLoader.java:807)
    at org.hibernate.ogm.loader.impl.OgmLoader.doQuery(OgmLoader.java:393)
    at org.hibernate.ogm.loader.impl.OgmLoader.doQueryAndInitializeNonLazyCollections(OgmLoader.java:283)
    at org.hibernate.ogm.loader.impl.OgmLoader.loadEntity(OgmLoader.java:201)
    at org.hibernate.ogm.loader.impl.OgmLoader.loadEntitiesFromTuples(OgmLoader.java:220)
    at org.hibernate.ogm.loader.entity.impl.DynamicBatchingEntityLoaderBuilder$DynamicBatchingEntityLoader.loadEntitiesFromTuples(DynamicBatchingEntityLoaderBuilder.java:127)
    at org.hibernate.ogm.query.impl.OgmQueryLoader.listOfEntities(OgmQueryLoader.java:92)
    at org.hibernate.ogm.query.impl.OgmQueryLoader.list(OgmQueryLoader.java:78)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501)
    at org.hibernate.ogm.query.impl.OgmQueryTranslator.list(OgmQueryTranslator.java:129)
    at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1339)
    at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87)
    at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606)
    at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:483)
    at com.olp.jpa.common.AbstractRepositoryImpl.findAll(AbstractRepositoryImpl.java:137)

The issue looked similar to the one reported here - https://github.com/hazelcast/hazelcast-hibernate5/issues/13 , however I cannot upgrade ORM to 5.2, since it is not supported by OGM yet. Please suggest if there is a solution/workaround for the issue.

Rajesh
  • 419
  • 1
  • 6
  • 20
  • 1
    Version 1.1.3 and 1.2 of `hazelcast-hibernate5` depend on Hibernate version `5.0.9.Final`. You might need to exclude that in your Maven configuration and declare Hibernate dependency with version 5.1.5 yourself. – emre Mar 29 '17 at 05:10

1 Answers1

2

Version 1.1.3 and 1.2 of hazelcast-hibernate5 depend on Hibernate version 5.0.9.Final. You might need to exclude that in your Maven configuration and declare Hibernate dependency with version 5.1.5 yourself.

Update

It seems hazelcast-hibernate5 doesn't support Hibernate 5.1.5. So I have modified hazelcast-hibernate5 code to support Hibernate 5.1.5 and released a custom version which can be found here. Note that this is not available on Maven central and it's not an official release of the plugin, just a quick change to support Hibernate 5.1.5 for your use case. It means that you have to install it to your local Maven repository first (or embed the JAR directly to your project). You can see the changes I have made in this branch to examine the code, or build from the source yourself.

emre
  • 677
  • 8
  • 18
  • Thanks Emre. This is what I have done -- com.hazelcast hazelcast-hibernate5 org.hibernate hibernate-core – Rajesh Mar 29 '17 at 06:49
  • And the hibernate dependency --- org.hibernate hibernate-core 5.1.5.Final Still hitting the same issue. Is that something different than what you suggested ? – Rajesh Mar 29 '17 at 06:49
  • @Rajesh That is exactly what I have suggested. This was the first thing to be sure about. Now that we're over this, I will look deeper into this. – emre Mar 29 '17 at 07:06
  • I'll try out the branched fix right away and update with my findings. Thanks a lot. – Rajesh Mar 29 '17 at 16:14
  • @Rajesh did you try the fix? – emre Mar 30 '17 at 13:21
  • I am sorry @Emre ... some emergency got me delayed. I have tried it now. Worked like a charm ! Many thanks for the quick resolution. – Rajesh Mar 30 '17 at 18:35
  • @Rajesh glad that it worked for you. Can you please accept it as an answer? http://stackoverflow.com/help/accepted-answer – emre Mar 31 '17 at 04:39
  • @Rajesh I think you have only upvoted. As the question owner, you can also accept an answer by checking the green check mark - see this link for how to do it: https://meta.stackexchange.com/a/5235 – emre Mar 31 '17 at 16:06
  • .@Emre , I am sorry. Just did it now. Thanks. – Rajesh Apr 01 '17 at 16:53