Skip to content
Snippets Groups Projects
Commit 764e4b80 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Persistence uses now pooled connections and statements.

parent d01efc86
No related branches found
No related tags found
No related merge requests found
......@@ -7,12 +7,43 @@
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- The database and the transaction manager. -->
<bean id="userDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" />
<property name="url" value="jdbc:derby:user;create=true" />
<!-- The following code is necessary to create a data source pooling connections and statements. -->
<bean id="connectionFactory" class="org.apache.commons.dbcp.DriverManagerConnectionFactory">
<constructor-arg index="0" value="jdbc:derby:user;create=true"/>
<!-- No further settings -->
<constructor-arg index="1">
<null/>
</constructor-arg>
</bean>
<bean id="connectionPool" class="org.apache.commons.pool.impl.GenericObjectPool">
</bean>
<bean id="statementPool" class="org.apache.commons.pool.impl.GenericKeyedObjectPoolFactory">
<constructor-arg index="0">
<null/>
</constructor-arg>
</bean>
<bean id="poolableConnectionFactory" class="org.apache.commons.dbcp.PoolableConnectionFactory">
<constructor-arg index="0" ref="connectionFactory"/>
<constructor-arg index="1" ref="connectionPool"/>
<constructor-arg index="2" ref="statementPool"/>
<!-- No validation query. -->
<constructor-arg index="3">
<null/>
</constructor-arg>
<!-- Queries are not read only per default. -->
<constructor-arg index="4" value="false"/>
<!-- Auto comit is activated per default. -->
<constructor-arg index="5" value="true"/>
</bean>
<bean id="userDataSource" class="org.apache.commons.dbcp.PoolingDataSource">
<property name="pool" ref="connectionPool"/>
</bean>
<!-- Configure a transaction manager for the data source. -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="userDataSource" />
</bean>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment