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 TNO <tn...@free.fr> on 2005/08/12 16:02:56 UTC
I can't see clearly...
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
Re: I can't see clearly...
Posted by Jeff Butler <je...@gmail.com>.
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 <tn...@free.fr> 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
>
>
>
>
Re: I can't see clearly...
Posted by Nathan Maves <Na...@Sun.COM>.
Once again the wiki saves all :)
http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?
pageId=584
Nathan
On Aug 12, 2005, at 8:08 AM, TNO wrote:
> Ok
> <select id="selectCount" parameterClass="string" resultClass="int">
> <![CDATA[
> SELECT count(*) FROM $value$
> ]]>
> </select>
>
> TNO a écrit :
>> 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.executeQu
>> eryWithCallback(GeneralStatement.java:181)
>> at
>> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQu
>> eryForObject(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.sqlExecut
>> eQuery(GeneralStatement.java:201)
>> at
>> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQu
>> eryWithCallback(GeneralStatement.java:169)
>> ... 24 more
>>
>>
>>
>>
>>
>
>
> --
> Il n'y a pas de mauvais langage, il n'y a que des bons programmeurs...
Re: I can't see clearly...
Posted by TNO <tn...@free.fr>.
Ok
<select id="selectCount" parameterClass="string" resultClass="int">
<![CDATA[
SELECT count(*) FROM *$value$*
]]>
</select>
TNO a écrit :
> 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
>
>
>
>
>
--
Il n'y a pas de mauvais langage, il n'y a que des bons programmeurs...
Re: I can't see clearly...
Posted by TNO <tn...@free.fr>.
Thanks... ;-)
Prashanth Sukumaran a écrit :
>Hi,
>
>How can you do this??
>
>The query you have defined will be created using a Prepared Statement. Underlying code would use
>ps.setString(1, value); But you want the table name to be dynamic.
>
>In JDBC how can you create a Prepared Statement and replace a table name. No Way.
>
>I think if you want to accomplish this in iBatis you can use $value$. That way it will directly do
>a String replace.
>
>Rgds
>
>Prashanth Sukumaran.
>
>
>
>
>--- TNO <tn...@free.fr> 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
>>
>>
>>
>>
>>
>>
>
>
>
>
>____________________________________________________
>Start your day with Yahoo! - make it your home page
>http://www.yahoo.com/r/hs
>
>
>
>
>
--
Il n'y a pas de mauvais langage, il n'y a que des bons programmeurs...
Re: I can't see clearly...
Posted by Prashanth Sukumaran <pr...@yahoo.com>.
Hi,
How can you do this??
The query you have defined will be created using a Prepared Statement. Underlying code would use
ps.setString(1, value); But you want the table name to be dynamic.
In JDBC how can you create a Prepared Statement and replace a table name. No Way.
I think if you want to accomplish this in iBatis you can use $value$. That way it will directly do
a String replace.
Rgds
Prashanth Sukumaran.
--- TNO <tn...@free.fr> 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
>
>
>
>
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs