Thanks for the suggested fix. I didn't found a smarter solution and did it in this way. Thanks again for reporting.
Best, Christian On Wed, Apr 11, 2012 at 8:04 PM, Aaron Daubman <daub...@gmail.com> wrote: > I have confirmed that a fix to CAMEL-5161, where MyBatis locking the DB due > to not closing a session that experienced an exception trying to insert a > duplicate unique index, is indeed to add another try/finally block inside > each of the finally blocks already used in the insert/update methods in: > > camel/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProducer.java > > Every Insert/Update related function in the file ends like: > ---snip--- > finally { > session.commit(); > session.close(); > } > ---snip--- > > Changing to: > ---snip--- > finally{ > try { > session.commit(); > } finally { > session.close(); > } > } > ---snip--- > prevents the issue I was experiencing from happening. > > I have not submitted a patch since it's a very minor change and I am > currently not working in an area where I have access to the SVN (or > internet) from my dev box. > > Is there a more elegant way to handle this than cascading try/finally > blocks? > Is there a (good) reason why all of the methods in MyBatisProducer.java > have blanket 'throws Exception' clauses (if they did not, the source of > this issue may have been more apparent). > > Thanks again, > Aaron >