Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 51274 invoked from network); 4 Jun 2007 18:41:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jun 2007 18:41:01 -0000 Received: (qmail 34237 invoked by uid 500); 4 Jun 2007 18:40:46 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 34226 invoked by uid 500); 4 Jun 2007 18:40:46 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 34209 invoked by uid 99); 4 Jun 2007 18:40:46 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jun 2007 11:40:46 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [169.155.34.12] (HELO supervalu.com) (169.155.34.12) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jun 2007 11:40:40 -0700 Received: from ([10.6.129.37]) by ironmail03.supervalu.com with ESMTP id 5202889.7865051; Mon, 04 Jun 2007 13:38:46 -0500 Received: from SDEPMSS506VR1.msg.albertsons.com ([10.6.129.40]) by SDEPMSS004.msg.albertsons.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 4 Jun 2007 13:39:58 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C7A6D7.C0D96428" Subject: RE: Database Blocking Date: Mon, 4 Jun 2007 13:39:58 -0500 Message-ID: <83B263FE838C2742AB866F230A952CEA2CC716@SDEPMSS506VR1.msg.albertsons.com> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Database Blocking Thread-Index: AceklIyEdtLOEz9lQji5FSKBqDJVPAABXIOAAIkFd2AAAVfpIAAB3eiAAAK5A28AAEoZsA== References: <83B263FE838C2742AB866F230A952CEA2CC465@SDEPMSS506VR1.msg.albertsons.com> <5820E7E2A928DB46824297946AC2024A9A62C1@pandore.ircm.priv> <83B263FE838C2742AB866F230A952CEA2CC653@SDEPMSS506VR1.msg.albertsons.com> <5820E7E2A928DB46824297946AC2024A9A62C3@pandore.ircm.priv> <83B263FE838C2742AB866F230A952CEA2CC6BB@SDEPMSS506VR1.msg.albertsons.com> From: "Reese, Rich R." To: X-OriginalArrivalTime: 04 Jun 2007 18:39:58.0786 (UTC) FILETIME=[C0E68220:01C7A6D7] X-Virus-Checked: Checked by ClamAV on apache.org This is a multi-part message in MIME format. ------_=_NextPart_001_01C7A6D7.C0D96428 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Our Abator generated DAOs are extending the org.springframework.orm.ibatis.support.SqlMapClientDaoSupport class, but our custom queries do not go through a DAO. They utilize iBATIS directly through the SQLMapClient object. Our architecture is trying to make it so the developer goes to a DAO for canned Abator generated queries, but then go directly to iBATIS for custom queries. Is it not possible or a good idea to go directly to iBATIS through the SqlMapClient? Should one always use a DAO? =20 Thanks, Rich=20 =20 ________________________________ From: Daniel Kalcevich [mailto:DKalcevich@marketlinx.com]=20 Sent: Monday, June 04, 2007 1:26 PM To: user-java@ibatis.apache.org Subject: RE: Database Blocking =20 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: =20 ------ what I am tyring to get at is that you should not have to explicitly build the SqlMapClient. =20 Daniel =20 ________________________________ From: Reese, Rich R. [mailto:Rich.R.Reese@supervalu.com] Sent: Mon 6/4/2007 10:11 AM 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: =20 InputStream is =3D getClass().getClassLoader().getResourceAsStream("SqlMapConfig.xml"); InputStreamReader reader =3D new InputStreamReader(is); SqlMapClient sqlMap =3D SqlMapClientBuilder.buildSqlMapClient(reader); =20 addresses =3D sqlMap.queryForList("Custom_Queries.selectAddress", = params); //error thrown here ... ... =20 =20 ________________________________ From: Poitras Christian [mailto:Christian.Poitras@ircm.qc.ca]=20 Sent: Monday, June 04, 2007 11:20 AM To: user-java@ibatis.apache.org Subject: RE: Database Blocking =20 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). =20 These calls may be the root cause of the problem. =20 =20 ________________________________ From: Reese, Rich R. [mailto:Rich.R.Reese@supervalu.com]=20 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: =20 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) =20 Its like iBATIS doesn't pick up on the spring transaction. =20 Thoughts? =20 ________________________________ From: Poitras Christian [mailto:Christian.Poitras@ircm.qc.ca]=20 Sent: Friday, June 01, 2007 5:16 PM To: user-java@ibatis.apache.org Subject: RE: Database Blocking =20 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... =20 Christian =20 ________________________________ From: Reese, Rich R. [mailto:Rich.R.Reese@supervalu.com]=20 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? =20 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? =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 Thanks, =20 Rich Reese =20 =20 ------_=_NextPart_001_01C7A6D7.C0D96428 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

Our Abator generated DAOs are = extending the org.springframework= .orm.ibatis.support.SqlMapClientDaoSupport class, but our custom queries do not go through a DAO.  They = utilize iBATIS directly through the SQLMapClient object.  Our architecture is = trying to make it so the developer goes to a DAO for canned Abator generated queries, = but then go directly to iBATIS for custom queries.  Is it not possible or a = good idea to go directly to iBATIS through the SqlMapClient?  Should one always = use a DAO?

 

=

Thanks,

Rich

 


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

 

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=3D"sqlMapClient"=

class=3D"org.springframework.orm.ibatis.SqlMapClient= FactoryBean">

<property name=3D"configLocation" value=3D"WEB-INF/sqlmap-config.xml"/>

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

</bean>

------

<bean id=3D"AccountDAO" class=3D"com.app.dao.impl.AccountDA= OImpl">

<property name=3D"sqlMapClient"<= /font>>

<ref local=3D"sqlMapClient"<= /font>/>

</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:Rich.R.Reese@supervalu.com]
Sent: Mon 6/4/2007 10:11 = AM
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 =3D getClass().getClassLoader().getResourceAsStream("SqlMapConfig.xml");                   =

InputStreamReader reader =3D new = InputStreamReader(is);

SqlMapClient sqlMap =3D SqlMapClientBuilder.buildSqlMapClient(reader);<= /font>

 

addresses =3D 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(SqlMa= pExecutorDelegate.java:782)

at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSess= ionImpl.java:176)

at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClien= tImpl.java:154)

at = com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(S= qlMapExecutorDelegate.java:883)

at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapE= xecutorDelegate.java:622)

at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapE= xecutorDelegate.java:589)

at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessio= nImpl.java:118)

at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientI= mpl.java:95)

at = com.sal.services.retail.storemaint.dao.StoreMapper.findAncillaryInfo(Stor= eMapper.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=3D"1.0" encoding=3D"UTF-8"?>

 

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

  xmlns:aop=3D"http://www.springframework.org/schema/aop"<= /font>

  xmlns:jee=3D"http://www.springframework.org/schema/jee"<= /font>

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

  xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"<= /font>

  = xsi:schemaLocation=3D"

    = 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=3D"dataSource"

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

   

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

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

   

  </bean>

 

  <bean = id=3D"sqlMapClient"

    = class=3D"org.springframework.orm.ibatis.SqlMapClientFactoryBean"= ;>

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

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

 

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

  </bean>

 

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

  <tx:annotation-driven transaction-manager=3D"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=3D"txManager"

    class=3D"org.springframework.jdbc.datasource.DataSourceTransactionMa= nager">

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

  </bean>

 

  <bean id=3D"StoreMaintService" class=3D"com.sal.services.retail.storemaint.service.impl.StoreMaintS= erviceImpl" />

 

</beans>

 

Thanks,

 

Rich Reese

 

 

------_=_NextPart_001_01C7A6D7.C0D96428--