Spring transaction not committing
I'm having a strange problem with my transactions not committing in spring. After profiling the database it looks like spring is committing the transaction before it starts?
Here is what I am seeing the the profiler..
SQL:BatchStarting select 1
SQL:BatchCompleted select 1
SQL:BatchStarting IF @@TRANCOUNT > 0 COMMIT TRAN
SQL:BatchCompleted IF @@TRANCOUNT > 0 COMMIT TRAN
RPC:Completed exec vbosv_DLLVersion_Update 77,N'15',NULL,N'12.2.2.1',N'12.2.3.4'
The transaction is not committed in this case but if i run a piece of code after this that calls the database again it will commit the previous transaction. I think that it is committing then because it starts with IF @@TRANCO开发者_如何学GoUNT > 0 COMMIT TRAN
.
I used declarative transaction management and here are some of my configs
<!-- Transactional Advice -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="process*" rollback-for="Throwable"/>
<tx:method name="write*" rollback-for="Throwable"/>
<tx:method name="upload*" rollback-for="Throwable"/>
<tx:method name="store*" rollback-for="Throwable"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="dataServicesOperation" expression="execution(* com.enterprise.dataservices.DataServicesImpl.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="dataServicesOperation"/>
</aop:config>
I'm a spring newbie and sort of lost on whats happening here. Thanks ahead for and help!
Do you have @Rollback(false)
on junit test method?
精彩评论