Hibernate Cache

hibernate

First Level Cache - Session
// If we look up an object via session.get, the next time that we look up 
// the same object again, Hibernate does not issue a query to the database.
// This is provided that the two session.get are using the same session object.

Second Level Cache:
1. Across sessions in an application
2. Across applications
3. Across clusters

<property name="cache.provider_class">org.hibernate.NoCacheProvider</property>
<property name="cache.user_second_level_cache">true</property>
<property name="cache.user_query_cache">true</property>
<property name="cache.provider_class">org.hibernate.EhCacheProvider</property>
@Cacheable
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
READ_ONLY
READ_WRITE
TRANSACTIONAL
NON_STRICT_READ_WRITE
EhCache
OSCache
query.setCacheable(true); // Make this query cacheable
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License