-->
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: Commit Transaction
PostPosted: Mon Feb 21, 2005 3:36 pm 
Newbie

Joined: Mon Feb 21, 2005 12:48 pm
Posts: 1
Location: Florence, SC
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:2

Mapping documents:any

Code between sessionFactory.openSession() and session.close():n/a

Full stack trace of any exception that occurs:n/a

Name and version of the database you are using:MySQL 4.0.12

The generated SQL (show_sql=true):n/a

Debug level Hibernate log excerpt:n/a

Hello,

I am reading Hibernate in Action. I plan to use the HibernateUtil version as outlined starting on page 301 of the book. I also plan to use the DAO pattern. I like the archtecture of this because the resulting code is clean. However, I have one question, where should I rollback a failed transaction? you suggest to comiton nn a filter

Thanks,

Jamey...

_________________
Jamey McElveen...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2005 6:15 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Well, it really depends on your exception handling. Usually (and especially with Hibernate3, where they are the default) I'd catch a RuntimeException at the highest layer and act accordingly. They are always fatal, so the best is a clean exit. It's more difficult to design an application that has some business related recovery functionality. So, wrap your fatal exceptions in RuntimeException, if you are using an EJB container, it will automatically rollback a global transaction if a RuntimeException is thrown.


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.