Composite Primary key

Caching is all about application performance optimization and it sits between your application and the database to avoid the number of database hits as many as possible to give a better performance for performance critical applications.

Ex. In amzon.com, has to display set of mobile from DB. for every request, if i am going to db, and fetch the record,then it create multiple hits and increase the data traffic.It will impact the application performance.Instead of this, we can store the request in Cache at initial hit and from there we can seve th user request.

Caching is important to Hibernate as well which utilizes a multilevel caching schemes as explained below: