You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Jan Rundström <ja...@ladok.umu.se> on 2006/05/29 13:44:13 UTC
{order}
Hello!
Im 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.executeQueryWith
Callback(GeneralStatement.java:188)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForL
ist(GeneralStatement.java:123)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExec
utorDelegate.java:610)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExec
utorDelegate.java:584)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionIm
pl.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.ja
va: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(RemoteTestRu
nner.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.processDynamicE
lements(SimpleDynamicSql.java:90)
at
com.ibatis.sqlmap.engine.mapping.sql.simple.SimpleDynamicSql.getSql(SimpleDy
namicSql.java:45)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWith
Callback(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?