Abhiram mishra
Abhiram mishra

Reputation: 1617

hibernate query cache and timestamp

Hibernate uses two cache regions for query cache, the org.hibernate.cache.internal.StandardQueryCache for storing the result set and the org.hibernate.cache.spi.UpdateTimestampsCache for storing the timestamp of the last updated table's timestamps. The UpdateTimestampsCache is consulted and updated when a new query is fired deciding to do a fresh query or use the existing records as the timestamp did not change.

The questions are

  1. How hibernate knows the timestamp or in other words what query does the hibernate fire to know the timestamp of underlying/used tables in the query ?
  2. Does hibernate use/query information_schema in case of mysql database ?
  3. Does the UpdateTimestampsCache involves only the tables in the query or all the tables ?

Upvotes: 1

Views: 1234

Answers (1)

JB Nizet
JB Nizet

Reputation: 691715

  1. It doesn't fire any query. It tracks all the inserts, updates and deletes being done in a table through the Hibernate API, and as soon as one is done, this table's timestamp is updated.
  2. no.

Upvotes: 3

Related Questions