When I remove the transaction info from the SQLMapConfig I get the following error:
Caused by: java.lang.NullPointerException at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlM apExecutorDelegate.java:782) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSes sionImpl.java:176) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClie ntImpl.java:154) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction( SqlMapExecutorDelegate.java:883) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap ExecutorDelegate.java:622) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap ExecutorDelegate.java:589) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessi onImpl.java:118) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClient Impl.java:95) at com.sal.services.retail.storemaint.dao.StoreMapper.findAncillaryInfo(Sto reMapper.java:149) Its like iBATIS doesn't pick up on the spring transaction. Thoughts? ________________________________ From: Poitras Christian [mailto:[EMAIL PROTECTED] Sent: Friday, June 01, 2007 5:16 PM To: [email protected] Subject: RE: Database Blocking 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:[EMAIL PROTECTED] Sent: Friday, 01 June 2007 17:34 To: [email protected] 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
