01: /*
02: * Created on 02-Feb-2006
03: */
04: package uk.org.ponder.rsf.hibernate3;
05:
06: import org.hibernate.Session;
07: import org.hibernate.Transaction;
08:
09: import uk.org.ponder.util.Logger;
10:
11: /**
12: * Cleanup methods necessary for Hibernate 2.x which has not yet moved over to
13: * unchecked exceptions.
14: *
15: * @author Antranig Basman (amb26@ponder.org.uk)
16: *
17: */
18: public class HibernateUtil {
19: public static void closeSession(Session toclose) {
20: if (toclose != null) {
21: try {
22: toclose.close();
23: } catch (Exception e) {
24:
25: try {
26: Logger.log.error("Error closing session", e);
27: } catch (Throwable t) {
28: }
29: }
30: }
31: }
32:
33: public static void rollbackTransaction(Transaction trans) {
34: if (trans != null) {
35: try {
36: trans.rollback();
37: } catch (Exception e) {
38: try {
39: Logger.log.error("Error rolling back transaction",
40: e);
41: } catch (Throwable t) {
42: }
43: }
44: }
45: }
46:
47: }
|