Reputation: 447
Inserting values in Oracle 11g via JdbcTemplate-OracleDataSource injected via Spring config file. Transactions are done via @Transactional managed by DataSourceTransactionManager.
Question 1) is how to set the autocommit value to false through the Spring config file. Tried with :
<property name="autoCommit" value="false" />
<property name="defaultAutoCommit" value="false" />
Both are giving error: org.springframework.beans.NotWritablePropertyException: Invalid property 'defaultAutoCommit' of bean class [oracle.jdbc.pool.OracleDataSource]
Thanks in advance.
Upvotes: 0
Views: 2847
Reputation: 21401
These properties won't work because there is no setAutoCommit()
or setDefaultAutoCommit()
methods in OracleDataSource.
What there is there and we can use instead is OracleDataSource#setConnectionProperties() that is has Properties as argument and we can define on the fly in the OracleDataSource Spring bean by adding property:
<property name="connectionProperties">
<props merge="default">
<prop key="AutoCommit">false</prop>
</props>
</property>
Upvotes: 1