[hibernate-dev] Provide a RegionFactory from Spring

Henri Tremblay henri.tremblay at gmail.com
Mon Jun 18 14:32:24 EDT 2018


Hi,

A change in the latest Spring Boot version is now setting a real class
loader when creating a JCache cache manager. Before it used to pass null.
Just like Hibernate still does.

So right now, we end up with two class managers. One for Hibernate 2nd
level cache and one for Spring cache.

We made a workaround in JHipster. You can see the full code and discussion
here
https://github.com/hibernate/hibernate-orm/pull/2351

It's not super pretty. The Hibernate region factory is instantiated from a
property using the no-args constructor. So we set the wanted class loader
to a static variable and retrieves it in the region factory implementation.
It works. But it's not pretty.

I was looking for a cleaner solution. Probably passing a Contributor to
Hibernate.

Is there a way to programmatically pass a contributor or a region factory
to Hibernate? From Spring Boot.

Thanks,
Henri


More information about the hibernate-dev mailing list