Easy learning with example program codes

caching in hibernate

Caching is a way to improve the performance of an application.  It uses buffer memory to stores recently used data from database to minimize the database hits.

Cache is useful when same data have to be fetched several times.

Types of cache in hibernate:

  • First level cache
  • Second level cache


First level cache in hibernate:

In hibernate, first level cache is enabled by default. First level cache is maintained by session objects.  Data available in first level cache will be available in that particular session only.


Second level cache in hibernate:

In hibernate, second level cache is not enabled by default. We need to enable it explicitly. Second level cache is maintained by session factory objects. Data available in second level cache is available in all sessions in the application.

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki