Question

Does anybody know if Hibernate's static initialize() method, which populates a proxy object, will attempt to hit the second-level cache before going to the database? My code seems to be behaving that way, and I can't seem to find anything in the documentation about this. The Java doc is (as usual) sparse.

Thanks!

Was it helpful?

Solution

It does. As long as second level caching is activated and that your entity is declared cacheable, then cache takes precedence when there is no explicite querying. You can follow the cache query/hit/miss by configuring the org.hibernate.cache logger.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top