hibernate-orm icon indicating copy to clipboard operation
hibernate-orm copied to clipboard

HHH-13046 ClassLoaderService in JCacheRegionFactory

Open milgner opened this issue 1 year ago • 1 comments

Addresses https://hibernate.atlassian.net/browse/HHH-13046 and enables the use of caching in scenarios where a non-standard class loader is registered using the service registry.

Unfortunately, since the service registry lifecycle is tied to the lifecycle of the SessionFactory, the required initialization happens too late for some of the test cases to "just work".

To keep compatibility with the specs from the test suite, some hackery is required: the JCacheRegionFactory has to hold on to some defaults from before being set up.

Note that while I did import the code style into IntelliJ, it seems like not all aspects were automatically resolved as I saw quite a few changes when running a full auto-format over the files. Instead I tried to manually match the existing code style wherever possible.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion. For more information on licensing, please check here.


milgner avatar Nov 30 '24 21:11 milgner

Hello! I'm commenting on this PR because I've been fighting for 3-4 days with hibernate-jcache. The issue I'm having is that the loading of the second level cache URI (spring.jpa.properties.hibernate.javax.cache.uri=classpath:ehcache-hibernate.xml) is failing on a native built image. (I've checked that the result contains the resource). On the other hand, the loading of spring resources like spring.cache.jcache.config=classpath:ehcache-spring.xml works fine.

Could be related to what are you guys here solving? Or if you can check if after this change the 2nd level cache with jcache works fine on a native build.

Thanks

fabianiacob avatar Jan 18 '25 18:01 fabianiacob

Hello @milgner , it seems Christian's comments haven't been addressed... Do you intend to resume your work? Otherwise we might have to close the PR and I'd hate to waste that effort :/

yrodiere avatar Oct 06 '25 09:10 yrodiere

As I currently have some free time on my hands, I'll give this another shot in the next couple of days. I'm also not very happy about the initial approach and will have to spend some more time familiarising myself with the codebase and reviewing the comments.

milgner avatar Oct 06 '25 09:10 milgner

That's awesome, looking forward to it @milgner . Please reach out on Zulip if you need to: https://hibernate.zulipchat.com/#narrow/channel/132094-hibernate-orm-dev

yrodiere avatar Oct 06 '25 09:10 yrodiere