How are you accessing the code shown in your last post? We are also using Spring with JBoss, and it works fine for us. We pretty much have the same thing you have defined in Spring context.xml file (for our SQL Map Client), but we inject the SQL Map client into our DAO's by extending the "org.springframework.orm.ibatis.support.SqlMapClientDaoSupport" class. Then, our app context looks like the following: <bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation" value="WEB-INF/sqlmap-config.xml"/> <property name="dataSource" ref="dataSource"/> </bean> ------ <bean id="AccountDAO" class="com.app.dao.impl.AccountDAOImpl"> <property name="sqlMapClient"> <ref local="sqlMapClient"/> </property> </bean> what I am tyring to get at is that you should not have to explicitly build the SqlMapClient. Daniel ________________________________ From: Reese, Rich R. [mailto:[EMAIL PROTECTED] Sent: Mon 6/4/2007 10:11 AM To: [email protected] Subject: RE: Database Blocking I don't have any transaction calls within my code. It must be internal calls within iBATIS. The line of code it fails on within my code is: InputStream is = getClass().getClassLoader().getResourceAsStream("SqlMapConfig.xml"); InputStreamReader reader = new InputStreamReader(is); SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader); addresses = sqlMap.queryForList("Custom_Queries.selectAddress", params); //error thrown here ... ... ________________________________ From: Poitras Christian [mailto:[EMAIL PROTECTED] Sent: Monday, June 04, 2007 11:20 AM To: [email protected] Subject: RE: Database Blocking If you want to use Spring transaction, you should let Spring handle them in all cases. So it would be better remove all calls like : sqlMap.startTransaction(); sqlMap.commitTransaction(); sqlMap.endTransaction(); iBATIS will automatically use the transaction started by Spring (since Spring seems to be correctly initiallised based on your file). These calls may be the root cause of the problem. ________________________________ From: Reese, Rich R. [mailto:[EMAIL PROTECTED] Sent: Monday, 04 June 2007 11:41 To: [email protected] Subject: RE: Database Blocking 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(SqlMapExecutorDelegate.java:782) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:176) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:154) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:883) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:622) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:95) at com.sal.services.retail.storemaint.dao.StoreMapper.findAncillaryInfo(StoreMapper.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.StoreMaintServiceImpl" /> </beans> Thanks, Rich Reese
<<winmail.dat>>
