What is the default cache used by Hibernate?

What is the default cache name used by Hibernate? Is there a default cache even, or do you need to add a cache provider to use the cache?

I thought it was EHCache, but I think it needs to be configured ... by default it is not ...

+4
source share
2 answers

Hibernate already provides caching mechanisms called the 1st level cache persistent context. It is in the Session area , enabled by default, and cannot be disabled.

A cache provider, such as EHCache, provides other caching mechanisms, called a second-level cache . It is located in the SessionFactory area . Layer 2 cache is not enabled by default, and you must configure it.

See this one to enable EHCache in sleep mode.

+7
source

By default, the inactive second level cache is turned on in sleep mode.

You can always choose one of these cache providers according to your needs:

  • Ehache
  • OSCache
  • Swarm cache
  • Jboss treecache
  • Jboss cache 2

You can always refer to the hibernation documentation to find out how to register it.

+2
source

All Articles