Unit06 Hibernate Caching
Unit06 Hibernate Caching
CACHING IN HIBERNATE
session.evict(entity); //session.clear();
Console log:
Console log:
Console log:
@Column(name = "dept_name")
private String deptName;
<ehcache>
<cache name="fa.training.entities.Departments"
maxElementsInMemory="1000" />
</ehcache>
} finally {
if (sessionA != null) {
sessionA.close();
}
if (sessionB != null) {
sessionB.close();
}
}
QUERY CACHE
CacheMode.REFRESH Doesn’t read from cache, but writes to the cache upon loading from
the database
CacheMode.PUT Doesn’t read from cache, but writes to the cache as it reads from
the database