adspace
Difference between first level and second level cache in hibernate?
Answer Posted / Uma Shankar
First Level Cache (FLC) and Second Level Cache (SLC) are caching mechanisms provided by Hibernate to improve application performance:
1. First Level Cache (FLC): It is automatically created by Hibernate for every Session object. The cache stores data that was recently loaded from the database. The objects in FLC are only accessible within the same session.
2. Second Level Cache (SLC): It provides a global scope across all Sessions and is configurable via hibernate.cfg.xml or programmatically using SessionFactory. It can be implemented using EHCache, Infinispan, or any other cache provider.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers