
Originally Posted by
pmularien
I would suspect that the answer depends on the data source that you have used to configure Spring Security. If you are using a transactional data source, then (IMO) it is you as the application designer who should dictate where transactional boundaries should be appropriately applied. Personally, I would rather that level of transactional control be in my hands than dictated arbitrarily by a framework designer (even though Luke is super smart)

That makes sense - but how can I acheive that?
In my security config I have
Code:
<security:remember-me data-source-ref="dataSource"/>
The dataSource bean looks like
Code:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${driverClassName}" />
<property name="url" value="jdbc:mysql://${hostname}/${schema}" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
<property name="defaultAutoCommit" value="false" />
<property name="defaultTransactionIsolation" value="2" /> <!-- READ_COMMITTED -->
<property name="validationQuery" value="SELECT 1 FROM DUAL;" />
<property name="maxActive" value="100" />
<property name="maxIdle" value="8" />
<property name="minIdle" value="2" />
<property name="maxWait" value="10000" />
<property name="removeAbandoned" value="true" />
<property name="removeAbandonedTimeout" value="10" />
<property name="testOnBorrow" value="true" />
</bean>
This dataSource source is used through an LocalContainerEntityManagerFactoryBean and has the foloowing transactionManager bean defined.
Code:
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
But the security tag has bypassed all of this and is using JDBC and accessing the dataSource directly. So how do I always make this dataSource transactional however its used?