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:
Configuration 2:
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)atcom.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:137)atcom.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:115)atcom.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:860)atcom.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:617)atcom.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:584)atcom.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:101)atcom.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:7Coolatcom.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.getResult(ResultLoader.java:72)atcom.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader.loadObject(LazyResultLoader.java:9Coolatcom.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: vars.client.getDelegate().setTxManager(txManager); In fact, the process(Node node) method that it is wrapped in is never invoked; I don't have the source for NodeletParser handy, so I can't see why it is failing. I can look into this further if this problem is not reproducible by the devs. Am I missing something from my setup, or this a bug in Ibatis? Thanks____________________________________________________ Do you Yahoo!? The New Yahoo! Movies: Check out the Latest Trailers, Premiere Photos and full Actor Database. http://au.movies.yahoo.com |
- Re: Lazy loader throwing NPE reuben
- Re: Lazy loader throwing NPE Geoff Chiang