-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: difference b/w synchronized and committed
PostPosted: Sun May 01, 2011 1:48 am 
Newbie

Joined: Sun May 01, 2011 12:29 am
Posts: 2
hi,

i want to discuss two words used in hibernate which is synchronized and committed data.

i think committed data into database means data will be permanently updated in database and when we reopen the session and trying to get data, we will get that data from database and code for committing is:

Session session = sessionFactory.openSession();
Transaction transaction = session.beginTransaction();
BallPlayer p = (BallPlayer)session.get(BallPlayer.class, 1L);
p.setNickname("Bambino"); //synchronizing
transaction.commit();
session.close();


Code for only synchronizing is:

Session session = sessionFactory.openSession();
Transaction transaction = session.beginTransaction();
BallPlayer p = (BallPlayer)session.get(BallPlayer.class, 1L);
p.setNickname("Bambino"); //synchronizing

in this way data is not updated in database and we can get updated data until session is not closed and when we close the session, then try to get that data, we will not get that data because it is not committed and was temporarily available


am i absolutely correct?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.