ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reub...@sonic.net
Subject Re: lazy loader NPE
Date Fri, 14 Oct 2005 22:06:20 GMT
I found one reference to this:

http://www.google.com/search?q=cache:y2UKgchz25IJ:mail-archives.apache.org/mod_mbox/incubator-ibatis-user-java/200502.mbox/%253C16178eb10502262030d30d080%40mail.gmail.com%253E+at+com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:776)&hl=en

According to the solution, I should add a TransactionManager to my sqlmap.
I haven't yet tried, but how does this play with Spring's transactions? My
transactions are currently setup via Spring's AOP framework:

            ProxyFactory pf = new ProxyFactory();
            pf.addInterface(DeploymentDao.class);
            pf.setTarget(new DeploymentDaoIbatis(ds));
            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");
            TransactionInterceptor ti = new TransactionInterceptor();
            ti.setTransactionAttributes(p);
            ti.setTransactionManager(new DataSourceTransactionManager(ds));
            pf.addAdvisor(new TransactionAttributeSourceAdvisor(ti));
            return (DeploymentDao) pf.getProxy();

For now I have turned lazy loading off; however I'd appreciate if somebody
could provide a workaround, since lazy loading seems to be valuable.

Thanks
Reuben

> What's going on here? I'm using Spring's transactions, not the Ibatis
> ones.
>
>
> java.lang.NullPointerException
> 	at
> 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:78)
> 	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:98)
> 	at
> com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader.invoke(LazyResultLoader.java:81)
> 	at $Proxy1.toArray(Unknown Source)
> 	at cnwk.deploy.beans.Operation.getScripts(Operation.java:142)
>
>



Mime
View raw message