Solved

automatic dirty checking

Posted on 2011-03-24
9
317 Views
Last Modified: 2012-05-11
Hi,

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.
0
Comment
Question by:gudii9
[X]
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
9 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 35211866

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

http://www.hibernate-training-guide.com/dirty-checking.html

http://whitesboard.blogspot.com/2009/10/hibernates-smart-automatic-dirty-check.html
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35211877
0
 
LVL 7

Author Comment

by:gudii9
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
0
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
LVL 47

Accepted Solution

by:
for_yan earned 500 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.

0
 
LVL 7

Author Comment

by:gudii9
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
0
 
LVL 47

Expert Comment

by:for_yan
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
committed
0
 
LVL 7

Author Comment

by:gudii9
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
0
 
LVL 47

Expert Comment

by:for_yan
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)
http://www.amazon.com/Java-Persistence-Hibernate-Christian-Bauer/dp/1932394885/ref=sr_1_1?s=books&ie=UTF8&qid=1303768128&sr=1-1


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

http://www.amazon.com/Spring-Persistence-Hibernate-Beginning-Tepper/dp/1430226323/ref=sr_1_5?s=books&ie=UTF8&qid=1303768128&sr=1-5



0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 500 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:

http://www.firstsql.com/tutor5.htm


http://download.oracle.com/javase/tutorial/jdbc/basics/transactions.html

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I remove an object from a 3 60
add projects t working set in maven 2 65
Java class and jar 3 58
Where to place postgres JDBC driver jar on tomcat 8 70
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

737 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