I think you must mean:
 
<select id="selectCount" parameterClass="string" resultClass="int">
   <![CDATA[
   SELECT count(*) FROM $value$
   ]]>
 </select>

Jeff Butler
 
On 8/12/05, TNO <[EMAIL PROTECTED]> wrote:
Hello, I have a simple problem but we are friday...

This is a simple statement

<select id="selectCount" parameterClass="string" resultClass="int">
   <![CDATA[
   SELECT count(*) FROM #value#
   ]]>
</select>

but... I must be blind ! there is a problem !
please help !!!

The log

DEBUG 15:59:16.812 {conn-100000} Connection  ( ConnectionLogProxy.java:42)
DEBUG 15:59:16.875 {pstm-100001} PreparedStatement:           SELECT
count(*) FROM ?          (PreparedStatementLogProxy.java:48)
DEBUG 15:59:16.875 {pstm-100001} Parameters: [mandat]
(PreparedStatementLogProxy.java:49)
DEBUG 15:59:16.875 {pstm-100001} Types: [java.lang.String]
(PreparedStatementLogProxy.java:50)


The exception trace

org.springframework.jdbc.BadSqlGrammarException : Bad SQL grammar [] in
task 'SqlMapClient operation'; nested exception is
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in arc/db/dao/ibatis/config/AgregatSQL.xml.
--- The error occurred while applying a parameter map.
--- Check the selectCount-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: org.postgresql.util.PSQLException: ERROR: syntax error at or
near "$1"
com.ibatis.common.jdbc.exception.NestedSQLException :
--- The error occurred in arc/db/dao/ibatis/config/AgregatSQL.xml.
--- The error occurred while applying a parameter map.
--- Check the selectCount-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: org.postgresql.util.PSQLException: ERROR: syntax error at or
near "$1"
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or
near "$1"
   at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback (GeneralStatement.java:181)
   at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:100)
   at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject (SqlMapExecutorDelegate.java:561)
   at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)
   at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject (SqlMapSessionImpl.java:97)
   at
org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:224)
   at
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java :181)
   at
org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:222)
   at arc.db.dao.ibatis.AgregatDAOiBatis.getCount(AgregatDAOiBatis.java:19)
   at arc.db.dao.ibatis.TestAgregatDao.testCount (TestAgregatDao.java:40)
   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: org.postgresql.util.PSQLException: ERROR: syntax error at or
near "$1"
   at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
   at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
   at
org.postgresql.core.v3.QueryExecutorImpl.execute (QueryExecutorImpl.java:175)
   at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
   at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java :330)
   at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:321)
   at
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:168)
   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
com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke(PreparedStatementLogProxy.java:57)
   at $Proxy1.execute(Unknown Source)
   at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery (SqlExecutor.java:180)
   at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:201)
   at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback (GeneralStatement.java:169)
   ... 24 more




Reply via email to