Understanding of level 1 cache and snapshot zone in Hibernate, level 1 cache in hibernate

Source: Internet
Author: User

Understanding of level 1 cache and snapshot zone in Hibernate, level 1 cache in hibernate

 

At the beginning, I felt that this snapshot zone was hard to understand. After reading many blogs online, I began to understand it. I understand it in combination with ADO. NET. There is a class in ADO. NET,

The name is SqlCommandBuilder. In my opinion, it is ADO.. NET and what corresponds to the Hibernate snapshot area. This SqlCommandBuilder can construct SQL statements. After the Update method is called, information in the database can be updated (including updated and deleted ), an enumeration class is also essential. It is the row state bit RowState class. I compare the row state bit with Hibernate (compare the cache and snapshot) as the corresponding class. However, when the cache area is refreshed, Hibernate compares the content in the cache area with that in the snapshot area (if different, it updates the snapshot area and stores an updata SQL statement, if a transaction is committed instead of a refresh operation, not only the updata statement is stored, but also the SQL statement of the updata is sent to the database for execution. NET does not compare, but records (that is, changes the RowStae value of the row). Finally, SqlCommandBuilder updates the row to the database based on the Status bit and primary key. In fact, in some ways, comparison is also a record (similar to modifying the row status bit), which is updated to the database until the transaction is committed.

 

In addition, I understand snapshot as a database snapshot (which is a snapshot of some rows of the database, and then an operation, then it is no longer a database snapshot, but after the transaction is committed, it becomes a snapshot of some rows in the database .)

For more information about SqlCommandBuilder, see this blog [SQLCommandBuilder class]

Also, this class [RowSate class]

Maybe I am not clear enough, but the current understanding is like this.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.