If MyBatis experiences an error on commit (e.g. unique PK violation) it appears 
to hold the session open and cause DB writelock errors
--------------------------------------------------------------------------------------------------------------------------------------

                 Key: CAMEL-5161
                 URL: https://issues.apache.org/jira/browse/CAMEL-5161
             Project: Camel
          Issue Type: Bug
          Components: camel-mybatis
    Affects Versions: 2.10.0
            Reporter: Aaron Daubman


When MyBatis experiences an error committing a statement the session.close() is 
not called and the DB is caught in a writelock state until camel is exited.
I have not tested a fix yet, but I believe that if, in: 
camel/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProducer.java
session.commit() is placed in a try/catch block with session.close() in its 
finally it will ensure the session is closed even when MyBatis throws an 
exception during a commit.

One of the exceptions I've experienced this with is 
'java.sql.BatchUpdateException' where a row was attempting to be inserted with 
a field that violated a table's unique index constraint.

I should be able to submit a patch later this week if necessary.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to