Sorry Reuben, but I'm not quite clear on how you're loading your
SqlMaps classes within Spring.  The reason that I'm wondering about
your Spring configuration is because I came across the same issue a
while back and fixed it by explicitly setting the dataSource property
of Spring's SqlMapClientFactoryBean in the Spring configuration.

Geoff


--- reuben <[EMAIL PROTECTED]> wrote:

> Sure. I can't do this via the BeanFactory (this is a standalone jar)
> so 
> I've been doing it in code as either one of the following to wrap the
> 
> DAO in transactions:
> 
> Configuration 1:
> 
> *Code:*
> 
>             Properties p = new Properties();
>             p.setProperty("create*", "ISOLATION_REPEATABLE_READ");
>             p.setProperty("update*", "ISOLATION_REPEATABLE_READ");
>             p.setProperty("remove*", "ISOLATION_REPEATABLE_READ");
>             p.setProperty("*", "PROPAGATION_REQUIRED,readOnly");
> 
>             TransactionProxyFactoryBean tpfb = new 
> TransactionProxyFactoryBean();
>             tpfb.setTransactionManager(new 
> DataSourceTransactionManager(ds));
>             tpfb.setTransactionAttributes(p);
>             tpfb.setTarget(new DeploymentDaoIbatis(ds));
>             tpfb.afterPropertiesSet();
>             return (DeploymentDao) tpfb.getObject();
> 
> 
> 
> Configuration 2:
> 
> *Code:*
> 
>             Properties p = new Properties();
>             p.setProperty("create*", "ISOLATION_REPEATABLE_READ");
>             p.setProperty("update*", "ISOLATION_REPEATABLE_READ");
>             p.setProperty("remove*", "ISOLATION_REPEATABLE_READ");
>             p.setProperty("*", "PROPAGATION_REQUIRED,readOnly");
> 
>             ProxyFactory pf = new ProxyFactory();
>             pf.addInterface(DeploymentDao.class);
>             pf.setTarget(new DeploymentDaoIbatis(ds));
> 
>             TransactionInterceptor ti = new TransactionInterceptor();
>             ti.setTransactionAttributes(p);
>             ti.setTransactionManager(new
> DataSourceTransactionManager(ds));
>             pf.addAdvisor(new TransactionAttributeSourceAdvisor(ti));
>             return (DeploymentDao) pf.getProxy();
> 
> 
> 
> However, why do you think this has anything to do with the Spring 
> transactions? From the Ibatis source code, it seems that calling:
> 
> SqlMapClient smc = SqlMapClientBuilder.buildSqlMapClient(new
> InputStreamReader(
> 
> leads to a txManager never being initted on SQLMapExecutorDelegate.
> Is 
> there another call that I'm supposed to be making?
> 
> Thanks
> Reuben
> 
> 
> Geoff Chiang wrote:
> 
> >Can you post your Spring configuration for the relevant beans?
> >
> >Geoff
> >
> >--- [EMAIL PROTECTED] wrote:
> >
> >  
> >
> >>If I turn lazy loading on, it is throwing an NPE from one specific
> >>sqlmaps
> >>query. The other queries & inserts work correctly.
> >>
> >>When I posted this problem last week, I misdirected attention by
> >>theorizing that this had something to do with the fact that I'm
> using
> >>spring transactions; I'm pretty sure it doesn't:
> >>
> >>The stacktrace is:
> >>
> >>
> >>    
> >>
>
>com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:776)
> >  
> >
> >>at
> >>
> >>    
> >>
>
>com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:137)
> >  
> >
> >>at
> >>
> >>    
> >>
>
>com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:115)
> >  
> >
> >>at
> >>
> >>    
> >>
>
>com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:860)
> >  
> >
> >>at
> >>
> >>    
> >>
>
>com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:617)
> >  
> >
> >>at
> >>
> >>    
> >>
>
>com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:584)
> >  
> >
> >>at
> >>
> >>    
> >>
>
>com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:101)
> >  
> >
> >>at
> >>
> >>    
> >>
>
>com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:7Cool
> >  
> >
> >>at
> >>
> >>    
> >>
>
>com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.getResult(ResultLoader.java:72)
> >  
> >
> >>at
> >>
> >>    
> >>
>
>com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader.loadObject(LazyResultLoader.java:9Cool
> >  
> >
> >>at
> >>
> >>    
> >>
>
>com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader.invoke(LazyResultLoader.java:81)
> >  
> >
> >>at $Proxy1.toArray(Unknown Source)
> >>
> >>At this point in the code, it is doing:
> >>
> >>txManager.end(session);
> >>
> >>txManager is, obviously, a TransactionManager; it is only built,
> >>apparently, from the constructor of SqlMapConfigParser.
> >>
> >>
> >>To initialize, I do, in the constructor of my class which extends
> >>SqlMapClientDaoSupport:
> >>
> >>        super.setDataSource(ds);
> >>        SqlMapClient smc =
> SqlMapClientBuilder.buildSqlMapClient(new
> >>InputStreamReader(         
> >>
> >>    
> >>
>
>Config.getClasspathResource("classpath:.../ibatisSQLMapsConfig.xml").getInputStream()));
> >  
> >
> >>        super.setSqlMapClient(smc);
> >>
> >>
> >>SqlMapClientBuilder.buildSqlMapClient(...)
> >>
> >>calls:
> >>
> >>  return new SqlMapConfigParser().parse(reader);
> >>
> >>The constructor with no arguments is as follows:
> >>
> >>  public SqlMapConfigParser() {
> >>    this(null, null);
> >>  }
> >>
> >>However, line 272 of SqlMapConfigParser is never reached:
> >>
> 
=== message truncated ===



                
____________________________________________________ 
Do you Yahoo!? 
The best of Hasselhoff on the web - Hoffice Attachments! 
http://au.news.yahoo.com/attachments/hoffice_attachments.html

Reply via email to