ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Parkinson" <pa...@avaning.com>
Subject Question(s) about DAO setup - possible Throttle deadlock?
Date Tue, 05 Aug 2008 23:32:02 GMT
Hello:
 
Hoping someone can help - I am running into what appears to be a
deadlock issue, and starting to investigate, but I thought I'd pop a
question or two out to see if anyone can help.
 
1. Is it bad practice for a Dao implementation to call another? I use
Spring to set everything up (see below). In one Dao object which
controls the Foo table, I also want to update the Bar table, so I am
doing:
 
public class FooDao extends SqlMapClientDaoSupport implements IFooDao
{
  final private static IBarDao BAR_DAO = (IBarDao)
getSpringContext().getBean("barDao)";
 
This way, in my save and update method, I can call to the BAR_DAO to
update that table.
 
Is this bad? Any hints on best practices here appreciated.
 
2. As noted above, I have seen some deadlock (and hence wondering
whether question #1 might be related) - when I looked at blocked
threads, I noted some references to the iBATIS Throttle object, and have
seen some articles related to this. I am using iBATIS verison 2.3.0.677
- should I upgrade?
 
3. My config set up is below - this seems to be all correct but
wondering if I've missed anything, or have anything set up obviously
wrong.
 
Any help is appreciated - regards,
 
Brian Parkinson
Avaning Inc.
parki@avaning.com
 
--- x8 snip
 
 <bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
>
  <property name="dataSource" ref="dataSource"/>
 </bean>
 
 <tx:advice id="txAdvice" transaction-manager="txManager">
  <tx:attributes>
   <tx:method name="get*" read-only="true" />
   <tx:method name="*" />
  </tx:attributes>
 </tx:advice>
 
 <aop:config>
  <aop:pointcut id="daoServiceOperation" expression="execution(*
com.ecobee.foundation.dao.ibatis.*.*(..))" />
  <aop:advisor advice-ref="txAdvice" pointcut-ref="daoServiceOperation"
/>
 </aop:config>
 
 <bean id="mapConfig"
class="org.springframework.core.io.ClassPathResource">
  <constructor-arg>
   <value>com/ecobee/foundation/dao/ibatis/SqlMapConfig.xml</value>
  </constructor-arg>
 </bean>
  
 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
  <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  <property name="url" value="jdbc:mysql:///ecobee" />
  <property name="username" value="XXX" />
  <property name="password" value="XXX" /> 
  <property name="initialSize" value="10" />
  <property name="maxActive" value="100" /> 
  <property name="maxIdle" value="10" />
 </bean>
 
 <bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="configLocation" ref="mapConfig" />
 </bean>
 
 <bean id="fooDao" class="com.ecobee.foundation.dao.ibatis.FooDao">
  <property name="sqlMapClient" ref="sqlMapClient" />
 </bean>
 
 <bean id="barDao" class="com.ecobee.foundation.dao.ibatis.BarDao">
  <property name="sqlMapClient" ref="sqlMapClient" />
 </bean>


Mime
View raw message