Thursday, 15 May 2014

java - first level hibernate cache , modify record directly at DB -


For the first level of the cache

, what do I understand when we work from savings, to refresh the cash Need to call flush () Call for DB to select the selection later, for application to use Hibernate, we use to modify records / records using Hibernate without using DB-GUI Should not be deleted because the selection is incorrect due to the cache Will query the result. right?

wrong. 1-level cache is always consistent with itself, and is consistent with the updates made in that session. When the session closes, all the updates are automatically flush, you have to call at least flush ()

In addition, 1-level The cache remains only for the duration of the hibernate session (which is usually the last for only a few SQL statements, and usually less than one second), so an updated database will be directly in the next hibernate session starting directly able to see.


No comments:

Post a Comment