Working with a first-level cache
Once we execute a particular query using hibernate, it always hits the database. As this process may be very expensive, hibernate provides the facility to cache objects within a certain boundary.
The basic actions performed in each database transaction are as follows:
- The request reaches the database server via the network.
- The database server processes the query in the query plan.
- Now the database server executes the processed query.
- Again, the database server returns the result to the querying application through the network.
- At last, the application processes the results.
This process is repeated every time we request a database operation, even if it is for a simple or small query. It is always a costly transaction ...
Get Java Hibernate Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.