-->
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: Hibernate session.close() - will flush the data to database?
PostPosted: Fri Jun 06, 2014 7:08 am 
Newbie

Joined: Thu Sep 22, 2011 9:06 am
Posts: 16
Hi Team,
I faced one problem, I am not using transaction but I have accessed persistent object. When I am trying to close the session, the updated data is reflected into database. Will session.close() flush the persistent data even I have not used transaction?

Code :
=====
try{
ElanTaskFolder folder=(ElanTaskFolder )session.get(ElanTaskFolder.class, folderId);//Get the object using the primary key
folder.setStartDate(new Date());
-------
-------
//I am not used flush or commit here. Just accessed db object and set the date only
} catch(Exception e{

} finally{
HibernateSessionFactory.closeSession();// The startDate will reflect current Date and Time in database? Actually, the current date is reflected in database. How it possible?
}

My conclusion, even close() is going to flush the data into db If i modify the persistent object


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.