ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TNO <tno...@free.fr>
Subject Re: Problem with multi-select inside a resultMap since Ibatis 2.20 (colored...)
Date Mon, 04 Sep 2006 22:03:41 GMT
This is a transaction problem... I think
It curious to open transaction to execute some select query, isn't-it ?

Class SqlMapExecutorDelegate and my txManager is null !
A test on txManager and a good error message would be great ;-)

  /**
   * Start a transaction on the session
   *
   * @param session - the session
   * @throws SQLException - if the transaction could not be started
   */
  public void startTransaction(SessionScope session) throws SQLException {
    try {
      txManager.begin(session);
    } catch (TransactionException e) {
      throw new NestedSQLException("Could not start transaction.  Cause:
" + e, e);
    }
  }

Jira or not ?

TNO a écrit :
> Hello,
>
> I have a new problem since we use Ibatis 2.2.0.
> I use multi select inside a resultMap for 1-N relations :
>
> <select id="getPlanOptionFromIdPlan" resultMap="planOptionResult">
>     <include refid="getPlanOptionSql"/>
>     WHERE plan_option.i_plan = #id#
>   </select>
>   <select id="getEcheanceOptionFromIdPlan" resultMap="echeanceOptionResult">
>     <include refid="getEcheanceOptionSql"/>
>     WHERE echeance_option.i_plan = #id#
>   </select>
>   <select id="getEcheancePlanFromIdPlan" resultMap="echeancePlanResult">
>     <include refid="getEcheancePlanSql"/>
>     WHERE echeance_plan.i_plan = #id#
>   </select>
>
>   <resultMap id="planResult1N" class="plan" extends="planResult">
>     <result property="listEcheanceOption"
> select="getEcheanceOptionFromIdPlan" column="plan_i_plan" />
>     <result property="listEcheancePlan"
> select="getEcheancePlanFromIdPlan" column="plan_i_plan" />
>     <result property="listPlanOption" select="getPlanOptionFromIdPlan"
> column="plan_i_plan" />
>   </resultMap>
>
>   <select id="getPlan1N" parameterClass="string" resultMap="planResult1N">
>     <include refid="getPlanSql"/>
>     $whereStr$
>   </select>
>
>   
> These selects work with previous version of Ibatis but with 2.2.0, I
> have this exception :
>
> org.springframework.jdbc.UncategorizedSQLException: SqlMapClient
> operation; uncategorized SQLException for SQL []; SQL state [null];
> error code [0];  
> --- The error occurred in arc/db/auto/dao/ibatis/config/PlanSQL.xml. 
> --- The error occurred while applying a result map. 
> --- Check the planResult1N. 
> --- Check the result mapping for the 'listEcheanceOption' property. 
> --- Cause: java.lang.NullPointerException; nested exception is
> com.ibatis.common.jdbc.exception.NestedSQLException:  
> --- The error occurred in arc/db/auto/dao/ibatis/config/PlanSQL.xml. 
> --- The error occurred while applying a result map. 
> --- Check the planResult1N. 
> --- Check the result mapping for the 'listEcheanceOption' property. 
> --- Cause: java.lang.NullPointerException
> com.ibatis.common.jdbc.exception.NestedSQLException:  
> --- The error occurred in arc/db/auto/dao/ibatis/config/PlanSQL.xml. 
> --- The error occurred while applying a result map. 
> --- Check the planResult1N. 
> --- Check the result mapping for the 'listEcheanceOption' property. 
> --- Cause: java.lang.NullPointerException
> Caused by: java.lang.NullPointerException
>     at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
>     at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:614)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:588)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
>     at
> org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:231)
>     at
> org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:168)
>     at
> org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:190)
>     at
> org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:229)
>     at
> arc.db.auto.dao.ibatis.PlanDAOiBatis.getList1N(PlanDAOiBatis.java:296)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>     at java.lang.reflect.Method.invoke(Unknown Source)
>     at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
>     at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:165)
>     at $Proxy0.getList1N(Unknown Source)
>     at
> arc.db.auto.dao.ibatis.TestPlanDAOiBatis.testGetList1N(TestPlanDAOiBatis.java:160)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>     at java.lang.reflect.Method.invoke(Unknown Source)
>     at junit.framework.TestCase.runTest(TestCase.java:154)
>     at junit.framework.TestCase.runBare(TestCase.java:127)
>     at junit.framework.TestResult$1.protect(TestResult.java:106)
>     at junit.framework.TestResult.runProtected(TestResult.java:124)
>     at junit.framework.TestResult.run(TestResult.java:109)
>     at junit.framework.TestCase.run(TestCase.java:118)
>     at junit.framework.TestSuite.runTest(TestSuite.java:208)
>     at junit.framework.TestSuite.run(TestSuite.java:203)
>     at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
>     at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: java.lang.NullPointerException
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:780)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:170)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:149)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:880)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:621)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:588)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:96)
>     at
> com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.getResult(ResultLoader.java:72)
>     at
> com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.loadResult(ResultLoader.java:59)
>     at
> com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getNestedSelectMappingValue(BasicResultMap.java:504)
>     at
> com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicResultMap.java:340)
>     at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:375)
>     at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:295)
>     at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:186)
>     at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
>     at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
>     ... 35 more
>
> Caused by:
> java.lang.NullPointerException
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:780)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:170)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:149)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:880)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:621)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:588)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:96)
>     at
> com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.getResult(ResultLoader.java:72)
>     at
> com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.loadResult(ResultLoader.java:59)
>     at
> com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getNestedSelectMappingValue(BasicResultMap.java:504)
>     at
> com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicResultMap.java:340)
>     at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:375)
>     at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:295)
>     at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:186)
>     at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
>     at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
>     at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:614)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:588)
>     at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
>     at
> org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:231)
>     at
> org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:168)
>     at
> org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:190)
>     at
> org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:229)
>     at
> arc.db.auto.dao.ibatis.PlanDAOiBatis.getList1N(PlanDAOiBatis.java:296)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>     at java.lang.reflect.Method.invoke(Unknown Source)
>     at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
>     at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:165)
>     at $Proxy0.getList1N(Unknown Source)
>     at
> arc.db.auto.dao.ibatis.TestPlanDAOiBatis.testGetList1N(TestPlanDAOiBatis.java:160)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>     at java.lang.reflect.Method.invoke(Unknown Source)
>     at junit.framework.TestCase.runTest(TestCase.java:154)
>     at junit.framework.TestCase.runBare(TestCase.java:127)
>     at junit.framework.TestResult$1.protect(TestResult.java:106)
>     at junit.framework.TestResult.runProtected(TestResult.java:124)
>     at junit.framework.TestResult.run(TestResult.java:109)
>     at junit.framework.TestCase.run(TestCase.java:118)
>     at junit.framework.TestSuite.runTest(TestSuite.java:208)
>     at junit.framework.TestSuite.run(TestSuite.java:203)
>     at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
>     at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.11.7/436 - Release Date: 01/09/2006
>   

-- 
Il n'y a pas de mauvais langage, il n'y a que des bons programmeurs


Mime
View raw message