You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2012/08/06 21:34:03 UTC
svn commit: r1369940 -
/camel/trunk/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProducer.java
Author: bvahdat
Date: Mon Aug 6 19:34:02 2012
New Revision: 1369940
URL: http://svn.apache.org/viewvc?rev=1369940&view=rev
Log:
Comments added.
Modified:
camel/trunk/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProducer.java
Modified: camel/trunk/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProducer.java?rev=1369940&r1=1369939&r2=1369940&view=diff
==============================================================================
--- camel/trunk/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProducer.java (original)
+++ camel/trunk/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProducer.java Mon Aug 6 19:34:02 2012
@@ -44,7 +44,6 @@ public class MyBatisProducer extends Def
public void process(Exchange exchange) throws Exception {
SqlSession session = endpoint.getSqlSessionFactory().openSession();
-
try {
switch (endpoint.getStatementType()) {
case SelectOne:
@@ -68,12 +67,14 @@ public class MyBatisProducer extends Def
default:
throw new IllegalArgumentException("Unsupported statementType: " + endpoint.getStatementType());
}
-
+ // flush the batch statements and commit the database connection
session.commit();
} catch (Exception e) {
+ // discard the pending batch statements and roll the database connection back
session.rollback();
throw e;
} finally {
+ // and finally close the session as we're done
session.close();
}
}