Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


automatic dirty checking

Posted on 2011-03-24
Medium Priority
Last Modified: 2012-05-11

I wou.d like to know what is automatic dirty checking in hibernate. Whereand how and why to use it. Any ideas, resources, links, sample code highly appreciated. thanks in advance.
Question by:gudii9
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
LVL 47

Expert Comment

ID: 35211866

Thaerae are tons of stuff if you just google it - Automatic dirty checking hibernate -
some looks like very nicely written



Author Comment

ID: 35212082
I was not clear on

While a session remains open, if a Persistent object is modified, its data is kept synchronized with the database. The
data will be synchronized (but not committed) when session.flush() is called. It will be synchronized and committed
when the transaction is committed. It may be synchronized at other points

please advise
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 47

Accepted Solution

for_yan earned 2000 total points
ID: 35212133
When you make change in the database the change is visible to the current session only
until you commit the transaction. As sson as you commit the transaction the change becomes
visible to other sessions(connections) to the same database.
This allows you to do stepwise changes within your session not compromising the view on the
database from different session.

Suppose you record buy/sell operation in two steps.
In first step you move money to the account of the seller, in another
step you reduce the inventory of the objects, being sold.
If you commit each of the steps, then someone from outside at certain
moment will see both money and goods in the property of the seller, which may create cionfusion.
That's why these two steps are organized into one transaction - first
the datbase prepares both steps - and during that time only
through the connection which executes these changes you can see stepwise changes
and when you commit - both changes are made simlutaneiously
and they become visible from outside as committed transaction.
No one will be confused.


Author Comment

ID: 35354048
>>> first
the datbase prepares both steps - and during that time only
through the connection which executes these changes you can see stepwise changes

i was not clear on this part. when you say 'you can see' you mean other sessions see.
Other sessions only can see once you commit the changes of current transaction of couple of steps in current session right. please advise
LVL 47

Expert Comment

ID: 35354629
I mean that the session which executes changes will see every steps
of the process whereas other sessions will see only when the whole transaction is

Author Comment

ID: 35463066

Any good video tutorials, online trainings etc for these intricate concepts. What is the best book for hibernate. Any good ebook, tutorials explains step by step. please advise
LVL 47

Expert Comment

ID: 35463205

this is the most reviewd book on Hibernate  on Amazon (though reviews are not all absolutely positive and also
it is already from 2006)

This is the newer book and everyone praises it, but looks like not so
many folks yet read it:


LVL 47

Assisted Solution

for_yan earned 2000 total points
ID: 35463284

This particular topic in fact mostly has to do with
understanding of database transactions.
Therefore, I think
it would be useful to
 read a few pages about transcations to understand these
ideas in general, for example:




Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question