-->
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.  [ 2 posts ] 
Author Message
 Post subject: first hibernate app - transaction ?
PostPosted: Tue Aug 19, 2008 8:08 am 
Newbie

Joined: Thu Aug 14, 2008 3:53 am
Posts: 4
hi,

I've worked thru the first hibernate app but am slightly confused about transactions. In the web app version this line appears at start of doGet

// Begin unit of work
HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();

and commit at end of doGet:
ibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();


But what if i dont want everything in between in a transaction?

is it possible to do an insert/update in hibernate3 without it being in a transaction?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 19, 2008 12:59 pm 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
Everything you do with a database is within a transaction, you just might not have noted it. Working outside a transaction would mean that you have the chance ending up with corrupted data. For example if you could do an update without a transaction it would be ok for the update to update 5 of 10 records and then canceling the rest with some kind of exception.

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


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

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.