ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <n.beek...@wis.nl>
Subject RE: {order}
Date Mon, 29 May 2006 14:23:23 GMT
That seems like a bug in SimpleDynamicSql.processDynamicElements(), maybe you can use a debugger
to get some details on the exact cause of this.

 

Niels

 

________________________________

From: Jan Rundström [mailto:jan.rundstrom@ladok.umu.se] 
Sent: maandag 29 mei 2006 13:44
To: user-java@ibatis.apache.org
Subject: {order} 

 

Hello!

 

I'm using a MIMER DB and need to use the {order} statement in my SQL, in the .xml file, (see
below) to force the DB to execute stuff in my preferred order.

 

<select id="getKursRegDataFort" parameterClass="java.util.Map" resultClass="se.ladok.batch.ub04.vo.RegPostKursVO">

 

<![CDATA[   

select a.id, b.size, c.lenght 

from {order} ${mySchema}.table_A a, ${mySchema}.table_B b, ${mySchema}.table_C c

where a.id = b.id

and b.id = c.id

and c. length >= '42'  

 

]]>

</select>

 

 

 

However, the {order} statement causes the error: 

 

 

com.ibatis.common.jdbc.exception.NestedSQLException:   

--- The error occurred in se/ladok/batch/ub04/maps/KursRegFort.xml.  

--- The error occurred while preparing the mapped statement for execution.  

--- Check the getKursRegDataFort.  

--- Check the SQL statement.  

--- Cause: java.util.NoSuchElementException

Caused by: java.util.NoSuchElementException

      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:610)

      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 se.ladok.batch.ub04.dao.KursRegDAO.getKursRegData(KursRegDAO.java:44)

      at se.ladok.batch.ub04.dao.KursRegDAOTest.test1GetKursRegData(KursRegDAOTest.java:145)

      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.RemoteTestRunner.runTests(RemoteTestRunner.java:478)

     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Caused by: java.util.NoSuchElementException

      at java.util.StringTokenizer.nextToken(Unknown Source)

      at com.ibatis.sqlmap.engine.mapping.sql.simple.SimpleDynamicSql.processDynamicElements(SimpleDynamicSql.java:90)

      at com.ibatis.sqlmap.engine.mapping.sql.simple.SimpleDynamicSql.getSql(SimpleDynamicSql.java:45)

      at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:168)

      ... 22 more

 

 

But if write the from statement like this:

 

  from {order}  testinstance.table_A a, testinstance.table_B b, testinstance.table_C c

 

it works!

 

 

 

Does anyone know how to handle this?

 


Mime
View raw message