ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reese, Rich R." <Rich.R.Re...@supervalu.com>
Subject RE: Database Blocking
Date Tue, 05 Jun 2007 15:26:52 GMT
This fixed it!!!  I made the following changes:

 

1.)     Removed all transaction / Datasource entries out of the
SQLMapConfig.xml file and only have it in my spring-beans.xml file.

2.)     Changed my code so that I get an instance to the SqlMapClient
through the Map Factory Bean from the Spring Context for custom queries

3.)     Continue to have my DAO's extend the SqlMapClientDaoSupport
class for Abator generated methods.

 

Thanks for everyone's help,

Rich

 

________________________________

From: Daniel Kalcevich [mailto:DKalcevich@marketlinx.com] 
Sent: Monday, June 04, 2007 1:47 PM
To: user-java@ibatis.apache.org; user-java@ibatis.apache.org
Subject: RE: Database Blocking

 

You could do one of two things:

 

1. You could get the Sql Map Factory Bean from the Spring Context

2. Go through the SqlMapClientDaoSupport class and use the
getSqlMapClient() or getSqlMapClientTemplate() method

 

Daniel

 

________________________________

From: Reese, Rich R. [mailto:Rich.R.Reese@supervalu.com]
Sent: Mon 6/4/2007 11:42 AM
To: user-java@ibatis.apache.org
Subject: RE: Database Blocking

How do you initialize the sqlMap variable or make a call to the
queryForList method if you don't use the SqlMapClientBuilder?

 

________________________________

From: Poitras Christian [mailto:Christian.Poitras@ircm.qc.ca] 
Sent: Monday, June 04, 2007 1:33 PM
To: user-java@ibatis.apache.org
Subject: RE: Database Blocking

 

I doudt these code lines should be there.

iBATIS is configured by Spring with your configuration.

 

  <bean id="sqlMapClient"

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

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

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

 

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

  </bean>

 

Is there a reason you need to use SqlMapClientBuilder?

 

In my code, I only keep

addresses = sqlMap.queryForList("Custom_Queries.selectAddress", params);


 

Try this!

Christian

 

________________________________

From: Reese, Rich R. [mailto:Rich.R.Reese@supervalu.com] 
Sent: Monday, 04 June 2007 13:12
To: user-java@ibatis.apache.org
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:Christian.Poitras@ircm.qc.ca] 
Sent: Monday, June 04, 2007 11:20 AM
To: user-java@ibatis.apache.org
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:Rich.R.Reese@supervalu.com] 
Sent: Monday, 04 June 2007 11:41
To: user-java@ibatis.apache.org
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(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:Christian.Poitras@ircm.qc.ca] 
Sent: Friday, June 01, 2007 5:16 PM
To: user-java@ibatis.apache.org
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: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