Disable autocommit
kevinthackray May 8, 2013 9:26 AMHi,
I cannot find the way to disable auto-commit with FuseESB.
I am using Oracle's datasource from Oracle's JDBC driver (oracle.jdbc.pool.OracleDataSource) and autocommit is set by default to true.
this is my spring configuration:
<bean id="my.dataSource" class="oracle.jdbc.pool.OracleDataSource"
destroy-method="close">
<property name="URL" value="${jdbc.database.url}" />
<property name="user" value="${jdbc.databasev.username}" />
<property name="password" value="${jdbc.database.password}" />
<property name="connectionCachingEnabled" value="true" />
*<property name="connection.autoCommit" value="false" />*
<property name="connectionCacheProperties">
<props merge="default">
<prop key="MinLimit">${database.pool.minLimit}</prop>
<prop key="MaxLimit">${database.pool.maxLimit}</prop>
<prop key="InitialLimit">${database.pool.initLimit}</prop>
<prop key="ConnectionWaitTimeout">${database.pool.connectionWaitTimeout}</prop>
<prop key="InactivityTimeout">${database.pool.inactivityTimeout}</prop>
<prop key="ValidateConnection">${database.pool.validateConnection}</prop>
</props>
</property>
</bean>
And this is my session factory:
<bean id="my.sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="my.dataSource">
</property>
<property name="packagesToScan">
<list>
<value>...</value>
</list>
</property>
<!-- mapping definitions are located in hibernate.cfg.xml -->
<property name="hibernateProperties">
<props>
<prop key="current_session_context_class">thread</prop>
<prop key="hibernate.dialect">${jdbc.database.hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${jdbc.database.hibernate.show_sql}</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</prop>
<prop key="hibernate.jdbc.batch_versioned_data">true</prop>
<prop key="hibernate.order_updates">true</prop>
<prop key="hibernate.order_inserts">true</prop>
<!-- Enable JDBC batch processing with resonable size -->
<prop key="hibernate.jdbc.batch_size">${jdbc.database.batch_size}</prop>
<!-- 2nd level cache -->
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.connection.autocommit">false</prop>
</props>
</property>
</bean>
In the 2 lines in bold, I have tried to disable autocommit without sucess.
Any idea how I can achieve this?
Having autocommit enabled completly breaks the transactional nature of my services (especially when I need to rollback).
BTW, I am using build-in Fuse JTA transaction manager wired to @Transaction spring annotation on my services.
Kind regards,
Kevin.