ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Poitras Christian" <Christian.Poit...@ircm.qc.ca>
Subject RE: Database Blocking
Date Fri, 01 Jun 2007 22:16:28 GMT
If you plan to use Spring transaction, you should remove the one in
SqlMapConfig.xml.
It is quite probable that they can block each other...
 
Christian

________________________________

From: Reese, Rich R. [mailto:Rich.R.Reese@supervalu.com] 
Sent: Friday, 01 June 2007 17:34
To: user-java@ibatis.apache.org
Subject: Database Blocking



I am using iBATIS with Spring DAOs.  My application is deployed within a
WAR onto a JBoss 4.0.4 server connecting to a MS Sql Server database.
Everything works fine until I try to have Spring manage the database
transaction from one of my business objects.  The problem I am having is
I keep getting database blocks on the table I am inserting or deleting
records from.  I don't have this problem when I keep the transaction
management out of the spring-beans.xml file.  I have attached what I
have in the file.  Can someone tell me what I might be missing or
stating incorrectly?

 

Another confusion I have a datasource defined in my spring-beans.xml
file and SqlMapConfig.xml file?  Why do I need it in both or do I?  Is
there a way to tell the SqlMapconfig.xml to use the transaction defined
in the spring-beans.xml?

 

 

<?xml version="1.0" encoding="UTF-8"?>

 

<beans xmlns="http://www.springframework.org/schema/beans"

  xmlns:aop="http://www.springframework.org/schema/aop"

  xmlns:jee="http://www.springframework.org/schema/jee"

  xmlns:tx="http://www.springframework.org/schema/tx"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xsi:schemaLocation="

    http://www.springframework.org/schema/aop

    http://www.springframework.org/schema/aop/spring-aop-2.0.xsd

    http://www.springframework.org/schema/beans

    http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

    http://www.springframework.org/schema/jee

    http://www.springframework.org/schema/jee/spring-jee-2.0.xsd

    http://www.springframework.org/schema/tx

    http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"

> 

 

  <bean id="dataSource"

    class="org.springframework.jndi.JndiObjectFactoryBean">

    

    <!-- See jboss-web.xml for definition of jndiNames -->

    <property name="jndiName" value="java:jdbc/storesSqlServerDB"/>

    

  </bean>

 

  <bean id="sqlMapClient"

    class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">

<!--    <property name="configLocation"
value="/WEB-INF/classes/SqlMapConfig.xml"/> -->

    <property name="configLocation" value="classpath:SqlMapConfig.xml"/>

 

    <property name="dataSource" ref="dataSource"/>

  </bean>

 

  <!-- Allows developer to put tag at top of method to specify tx needs
-->    

  <tx:annotation-driven transaction-manager="txManager"/>

 

  <!-- Takes care of adding proxy around classes which need
transactions.  

   This proxy handles starting the transaction and the commits and
rollbacks versus the 

   developer adding this code themselves.

   -->

  <aop:aspectj-autoproxy/>

 

  <bean id="txManager"

 
class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
>

    <property name="dataSource" ref="dataSource"/>

  </bean>

  

  <bean id="StoreMaintService"
class="com.sal.services.retail.storemaint.service.impl.StoreMaintService
Impl" />

 

</beans>

 

Thanks,

 

Rich Reese

 

 


Mime
View raw message