What are the options to disable second level cache in Hibernate?

This is a trick question. By default Second level cache is already disabled in Hibernate.

In case, your project is using a second level cache you can use one of the following options to disable second level cache in Hibernate:

  • We can set hibernate.cache.use_second_level_cache to false.
  • We can use CacheMode.IGNORE to stop interaction between the session and second-level cache. Session will interact with cache only to invalidate cache items when updates occur
Read the full book at www.amazon.com
Posted in Hibernate, Hibernate Interview Questions

Leave a Reply

Your email address will not be published. Required fields are marked *