Author: agilliland
Date: Mon Apr 17 11:05:29 2006
New Revision: 394741
URL: http://svn.apache.org/viewcvs?rev=394741&view=rev
Log:
it appears that calling Transaction.rollback() effectively closes the session,
so we don't need to call Session.close() explicitly in the finally block after
a release().
Modified:
incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePersistenceStrategy.java
Modified:
incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePersistenceStrategy.java
URL:
http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePersistenceStrategy.java?rev=394741&r1=394740&r2=394741&view=diff
==============================================================================
---
incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePersistenceStrategy.java
(original)
+++
incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePersistenceStrategy.java
Mon Apr 17 11:05:29 2006
@@ -20,23 +20,12 @@
/**
- * Base class for Hibernate persistence strategy.
+ * Base class for Hibernate persistence implementation.
*
* This class serves as a helper/util class for all of the Hibernate
* manager implementations by providing a set of basic persistence methods
* that can be easily reused.
*
- * IMPORTANT: some of the persistence methods in this class do not contain any
- * transaction logic. they do not attempt to start/join a transaction at
- * the beginning of an operation and they do not attempt to commit or rollback
- * at the end of an operation. this is done purposely so that these methods
- * can be called repeatedly by the manager impls to make up a transaction.
- *
- * an example of this would be if the properties manager impl wanted to store
- * a list of properties all in one transaction then it could do so by starting
- * a transaction, then calling the store() method of this class XX times, and
- * then finally doing a commit.
- *
*/
public class HibernatePersistenceStrategy {
@@ -107,7 +96,9 @@
} catch(Throwable t) {
log.error("ERROR doing Hibernate rollback", t);
} finally {
- session.close();
+ if(session.isOpen()) {
+ session.close();
+ }
}
}
} catch(Throwable t) {