[jbpm-commits] JBoss JBPM SVN: r5973 - in jbpm4/trunk/modules/pvm: src/main/java/org/jbpm/pvm/internal/tx and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Dec 16 15:46:03 EST 2009
Author: tom.baeyens at jboss.com
Date: 2009-12-16 15:46:03 -0500 (Wed, 16 Dec 2009)
New Revision: 5973
Added:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransactionFactory.java
Modified:
jbpm4/trunk/modules/pvm/pom.xml
Log:
JBPM-2631 spring transactions. added spring transaction factory (not used yet)
Modified: jbpm4/trunk/modules/pvm/pom.xml
===================================================================
--- jbpm4/trunk/modules/pvm/pom.xml 2009-12-16 16:30:02 UTC (rev 5972)
+++ jbpm4/trunk/modules/pvm/pom.xml 2009-12-16 20:46:03 UTC (rev 5973)
@@ -132,6 +132,10 @@
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransactionFactory.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransactionFactory.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransactionFactory.java 2009-12-16 20:46:03 UTC (rev 5973)
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jbpm.pvm.internal.tx;
+
+import java.util.Properties;
+
+import org.hibernate.ConnectionReleaseMode;
+import org.hibernate.Transaction;
+import org.hibernate.jdbc.JDBCContext;
+import org.hibernate.transaction.JDBCTransaction;
+import org.hibernate.transaction.TransactionFactory;
+
+import org.springframework.transaction.support.TransactionSynchronizationManager;
+
+/**
+ * Spring-aware implementation of the Hibernate TransactionFactory interface, aware of
+ * Spring-synchronized transactions (in particular Spring-managed JTA transactions)
+ * and asking for default release mode ON_CLOSE. Otherwise identical to Hibernate's
+ * default {@link org.hibernate.transaction.JDBCTransactionFactory} implementation.
+ *
+ * @author Juergen Hoeller
+ * @since 2.5.4
+ * @see org.springframework.transaction.support.TransactionSynchronizationManager
+ * @see org.hibernate.transaction.JDBCTransactionFactory
+ */
+public class SpringTransactionFactory implements TransactionFactory {
+
+ /**
+ * Sets connection release mode "on_close" as default.
+ * <p>This was the case for Hibernate 3.0; Hibernate 3.1 changed
+ * it to "auto" (i.e. "after_statement" or "after_transaction").
+ * However, for Spring's resource management (in particular for
+ * HibernateTransactionManager), "on_close" is the better default.
+ */
+ public ConnectionReleaseMode getDefaultReleaseMode() {
+ return ConnectionReleaseMode.ON_CLOSE;
+ }
+
+ public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext) {
+ return new JDBCTransaction(jdbcContext, transactionContext);
+ }
+
+ public void configure(Properties props) {
+ }
+
+ public boolean isTransactionManagerRequired() {
+ return false;
+ }
+
+ public boolean areCallbacksLocalToHibernateTransactions() {
+ return true;
+ }
+
+ public boolean isTransactionInProgress(
+ JDBCContext jdbcContext, Context transactionContext, Transaction transaction) {
+
+ return (transaction != null && transaction.isActive()) ||
+ TransactionSynchronizationManager.isActualTransactionActive();
+ }
+
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransactionFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jbpm-commits
mailing list