views:

1300

answers:

1

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 Javadoc is (as usual) sparse.

Thanks!

+3  A: 

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.

Damien B