Hibernate implements a technique known as write-behind, to minimize the impact of network latency and duration of database lock. This enables hibernate makes DML calls as late as possible.
What it actually means is: When objects associated with a persistence context are modified (by update/delete), the changes are not propagated immediately to the database.
What it actually means is: When objects associated with a persistence context are modified (by update/delete), the changes are not propagated immediately to the database.
Benefits of this technique
- If you made two updates to an entity in a session; hibernate doesn't have to make two SQL updates. It can manage both in the same update.
- Hibernate can make use of JDBC batch update when it executes multiple INSERT, UPDATE or DELETE.
- Repeated flushing (synchronization of a persistence context with the database) of the persistence context also impacts performance. All dirty objects in the persistence context need to be detected (at the flush time), so if the size of persistent context is large then dirty checking can cause a lot of performance penalty.
No comments:
Post a Comment