Ignite as Hibernate L2 Cache

classic Classic list List threaded Threaded
8 messages Options
yarden yarden
Reply | Threaded
Open this post in threaded view
|

Ignite as Hibernate L2 Cache

Hi all,
I am trying to configure Ignite as second-level cache in Hibernate.
I followed the instructions on this link:
https://apacheignite-mix.readme.io/docs/hibernate-l2-cache
<https://apacheignite-mix.readme.io/docs/hibernate-l2-cache>  
But it seems that the example is for Hibernate with Spring.
I am using Hibernate 5.2.5 with Java Enterprise Edition.

So I am configuring the second level cache on the persistence.xml, but I
have two persistence units.
For both I defined the same factory class and instance name.
Then I get an error on server startup that Ignite instance already exist.
Is there anyway to create the Ignite instance as a singleton?

Anyway, any example of Ignite as Hibernate L2 Cache for JEE will be a great
help.
Thanks!



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
scottmf scottmf
Reply | Threaded
Open this post in threaded view
|

Re: Ignite as Hibernate L2 Cache

Hi,
On a slightly different note, I'm going through a similar exercise with
Hibernate 5.2.x using Spring.  What I've found is that the hibernate_5.1
library provided by Ignite will not work with Hibernate 5.2.x.

I just went through the exercise of updating the current library to work
with Hibernate 5.2.x.  I'll most likely post these changes to my github to
be contributed at some point if someone doesn't beat me to it.

For your immediate error I'd try Ignition.getOrStart(...) when instantiating
Ignite to avoid those errors.

Scott



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
yarden yarden
Reply | Threaded
Open this post in threaded view
|

Re: Ignite as Hibernate L2 Cache

Thanks a lot for your answer.
Can you share what was the error you encountered on Hibernate 5.2?





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Stanislav Lukyanov Stanislav Lukyanov
Reply | Threaded
Open this post in threaded view
|

RE: Ignite as Hibernate L2 Cache

In reply to this post by yarden

Hi,

 

Can’t say much about Java EE usage exactly but overall the idea is

  1. Start an Ignite node named “foo”, in the same JVM as the application, before Hibernate is initialized
  2. Specify `org.apache.ignite.hibernate.ignite_instance_name=foo` in the Hibernate session properties
  3. Do NOT specify ` org.apache.ignite.hibernate.grid_config` - if you do, the framework will try to start Ignite automatically, and you’ve already done it

 

If it still complains about an already started instance, please share the logs.

 

Thanks,

Stan

 

From: [hidden email]
Sent: 7 октября 2018 г. 16:12
To: [hidden email]
Subject: Ignite as Hibernate L2 Cache

 

Hi all,

I am trying to configure Ignite as second-level cache in Hibernate.

I followed the instructions on this link:

https://apacheignite-mix.readme.io/docs/hibernate-l2-cache

<https://apacheignite-mix.readme.io/docs/hibernate-l2-cache> 

But it seems that the example is for Hibernate with Spring.

I am using Hibernate 5.2.5 with Java Enterprise Edition.

 

So I am configuring the second level cache on the persistence.xml, but I

have two persistence units.

For both I defined the same factory class and instance name.

Then I get an error on server startup that Ignite instance already exist.

Is there anyway to create the Ignite instance as a singleton?

 

Anyway, any example of Ignite as Hibernate L2 Cache for JEE will be a great

help.

Thanks!

 

 

 

--

Sent from: http://apache-ignite-users.70518.x6.nabble.com/

 

scottmf scottmf
Reply | Threaded
Open this post in threaded view
|

Re: Ignite as Hibernate L2 Cache

In reply to this post by yarden
It’s an AbstractMethodError caused since the library isn’t compiled with the 5.2 hibernate spec.

On Tue, Oct 9, 2018 at 1:23 AM yarden <[hidden email]> wrote:
Thanks a lot for your answer.
Can you share what was the error you encountered on Hibernate 5.2?





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Ignite as Hibernate L2 Cache

Hello!

I guess you will have to downgrade to 5.1 then.

You can fill a ticket against Apache Ignite JIRA so maybe we support 5.2 too in the future.

Regards,
--
Ilya Kasnacheev


ср, 10 окт. 2018 г. в 7:19, Scott Feldstein <[hidden email]>:
It’s an AbstractMethodError caused since the library isn’t compiled with the 5.2 hibernate spec.

On Tue, Oct 9, 2018 at 1:23 AM yarden <[hidden email]> wrote:
Thanks a lot for your answer.
Can you share what was the error you encountered on Hibernate 5.2?





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
scottmf scottmf
Reply | Threaded
Open this post in threaded view
|

Re: Ignite as Hibernate L2 Cache

hi, I have committed my hibernate-5.2 code to a local repo in github and
filed a jira ticket
https://issues.apache.org/jira/browse/IGNITE-9893

repo -> https://github.com/scottmf/ignite



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Stanislav Lukyanov Stanislav Lukyanov
Reply | Threaded
Open this post in threaded view
|

RE: Ignite as Hibernate L2 Cache

Hi,

 

If you’d like to contribute (that’s great!) please follow this process:

https://ignite.apache.org/community/contribute.html

 

In short, you need to introduce yourself as a contributor on [hidden email],

create a pull request on GitHub, run tests and request a review.

 

Good luck!

Stan

 

From: [hidden email]
Sent: 15 октября 2018 г. 22:01
To: [hidden email]
Subject: Re: Ignite as Hibernate L2 Cache

 

hi, I have committed my hibernate-5.2 code to a local repo in github and

filed a jira ticket

https://issues.apache.org/jira/browse/IGNITE-9893

 

repo -> https://github.com/scottmf/ignite

 

 

 

--

Sent from: http://apache-ignite-users.70518.x6.nabble.com/