[hibernate-dev] Provide a RegionFactory from Spring
Henri Tremblay
henri.tremblay at gmail.com
Wed Jun 20 14:58:37 EDT 2018
Thanks Steve.
If I got it right, to gain flexibility we should instantiate
programmatically?
Because right now, the region factory is a class defined in the Spring
configuration.
Do you have an code example (I haven't done programmatic instantiation of
Hibernate for a long long time)
On Mon, 18 Jun 2018 at 16:52, Steve Ebersole <steve at hibernate.org> wrote:
> Or Class (not String) loaded from the proper ClassLoader
>
> On Mon, Jun 18, 2018 at 3:51 PM Steve Ebersole <steve at hibernate.org>
> wrote:
>
>> You can pass a RegionFactory instance.
>>
>> On Mon, Jun 18, 2018 at 1:48 PM Henri Tremblay <henri.tremblay at gmail.com>
>> wrote:
>>
>>> 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
>>> _______________________________________________
>>> hibernate-dev mailing list
>>> hibernate-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>
>>
More information about the hibernate-dev
mailing list