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 ay...@jpmchase.com on 2006/10/18 19:56:11 UTC
Dynamic where clause problem
I am currently depending on one statement to handle returning all rows
from a table, as well as returning only some rows based on some keys.
The query is as below. But everytime I try to execute this, I get:
UncategorizedSQLException: SqlMapClient operation; uncategorized
SQLException for SQL []; SQL state [37000]; error code [102]; --- The
error occurred while applying a parameter map. --- Check the
AccountMappings.getById-InlineParameterMap. --- Check the statement (query
failed). --- Cause: java.sql.SQLException: Incorrect syntax near
'BUS_SYS_CATG_CD'. ; nested exception is
com.ibatis.common.jdbc.exception.NestedSQLException: --- The error
occurred while applying a parameter map. --- Check the
AccountMappings.getById-InlineParameterMap. --- Check the statement (query
failed). --- Cause: java.sql.SQLException: Incorrect syntax near
'BUS_SYS_CATG_CD'.
<select id="getById" resultMap="STG1_ACCOUNT_SERVICE_MAPPINGObject"
parameterClass="accountServiceSearchObject">
SELECT BUS_SYS_CATG_CD as BUS_SYS_CATG_CD,
ACC_SERV_NM as ACC_SERV_NM,
isnull(ACCT_PRD_ID,-1) as ACCT_PRD_ID
FROM STG1_ACCOUNT_SERVICE_MAPPING
<dynamic prepend="WHERE">
<isNotEmpty property="accServName">
ACC_SERV_NM = #accServName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="busSysCode">
BUS_SYS_CATG_CD = #busSysCode#
</isNotEmpty>
</dynamic>
</select>
Any idea what is going on?
Thanks,
Ayan
"Clinton Begin" <cl...@gmail.com>
10/18/2006 10:47 AM
Please respond to
user-java@ibatis.apache.org
To
user-java@ibatis.apache.org, Konus <ko...@i-c.com.ua>
cc
Subject
Re: IBATIS + AJA X.
No....
I haven't had time. But I'm speaking at NFJS Toronto, where I'll need to
again present the AJAX/iBATIS demo. So I should have time between
sessions to improve the JavaScript/iBATIS bridge servlet to make it nicer
to work with.
Any suggestions for a sample app?
Cheers,
Clinton
On 10/18/06, Rogov Andrey <konus@i-c.com.ua > wrote:
Hi Clinton,
Have you already prepared the example of IBATIS + AJAX?
--
regards,
Andrey. mailto:konus@i-c.com.ua
-----------------------------------------
This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and
any attachments are believed to be free of any virus or other
defect that might affect any computer system into which it is
received and opened, it is the responsibility of the recipient to
ensure that it is virus free and no responsibility is accepted by
JPMorgan Chase & Co., its subsidiaries and affiliates, as
applicable, for any loss or damage arising in any way from its use.
If you received this transmission in error, please immediately
contact the sender and destroy the material in its entirety,
whether in electronic or hard copy format. Thank you.
Re: Dynamic where clause problem
Posted by ay...@jpmchase.com.
Hi Gywn,
Thanks for the response. That leads to my second problem - am not sure how
to enable tracing. I have put the jog4j jar file into my lib directory,
and have put log4j.properties into my classpath, with these values:
log4j.rootLogger=DEBUG, stdout
# SqlMap logging configuration...
log4j.logger.com.ibatis=DEBUG
#log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
#log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
#log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
#log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
This should enable logging - but I get nothing printed on the console.
-Ayan
"Gwyn Evans" <gw...@gmail.com>
10/18/2006 02:24 PM
Please respond to
user-java@ibatis.apache.org
To
user-java@ibatis.apache.org
cc
Subject
Re: Dynamic where clause problem
On 18/10/06, ayan.x.afridi@jpmchase.com <ay...@jpmchase.com>
wrote:
>
> I am currently depending on one statement to handle returning all rows
from a table, as well as returning only some rows based on some keys.
>
> The query is as below. But everytime I try to execute this, I get:
>
> UncategorizedSQLException: SqlMapClient operation; uncategorized
SQLException for SQL []; SQL state [37000]; error code [102]; --- The
error occurred while applying a parameter map. --- Check the
AccountMappings.getById-InlineParameterMap. --- Check the statement (query
failed). --- Cause: java.sql.SQLException: Incorrect syntax near
'BUS_SYS_CATG_CD'. ; nested exception is
com.ibatis.common.jdbc.exception.NestedSQLException: --- The error
occurred while applying a parameter map. --- Check the
AccountMappings.getById-InlineParameterMap. --- Check the statement (query
failed). --- Cause: java.sql.SQLException: Incorrect syntax near
'BUS_SYS_CATG_CD'.
>
>
>
> <select id="getById" resultMap="STG1_ACCOUNT_SERVICE_MAPPINGObject"
parameterClass="accountServiceSearchObject">
> SELECT BUS_SYS_CATG_CD as
BUS_SYS_CATG_CD,
> ACC_SERV_NM as ACC_SERV_NM,
> isnull(ACCT_PRD_ID,-1) as ACCT_PRD_ID
> FROM STG1_ACCOUNT_SERVICE_MAPPING
> <dynamic prepend="WHERE">
> <isNotEmpty property="accServName">
> ACC_SERV_NM = #accServName#
> </isNotEmpty>
> <isNotEmpty prepend=" AND "
property="busSysCode">
> BUS_SYS_CATG_CD = #busSysCode#
> </isNotEmpty>
> </dynamic>
> </select>
>
> Any idea what is going on?
> Thanks,
> Ayan
>
I'd suggest enabling tracing for "java.sql" to see the actual
statement being generated and the params used, then duplicate it in a
command line client?
/Gwyn
--
Download Wicket 1.2.2 now! - http://wicketframework.org
-----------------------------------------
This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and
any attachments are believed to be free of any virus or other
defect that might affect any computer system into which it is
received and opened, it is the responsibility of the recipient to
ensure that it is virus free and no responsibility is accepted by
JPMorgan Chase & Co., its subsidiaries and affiliates, as
applicable, for any loss or damage arising in any way from its use.
If you received this transmission in error, please immediately
contact the sender and destroy the material in its entirety,
whether in electronic or hard copy format. Thank you.
Re: Dynamic where clause problem
Posted by Gwyn Evans <gw...@gmail.com>.
On 18/10/06, ayan.x.afridi@jpmchase.com <ay...@jpmchase.com> wrote:
>
> I am currently depending on one statement to handle returning all rows from a table, as well as returning only some rows based on some keys.
>
> The query is as below. But everytime I try to execute this, I get:
>
> UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [37000]; error code [102]; --- The error occurred while applying a parameter map. --- Check the AccountMappings.getById-InlineParameterMap. --- Check the statement (query failed). --- Cause: java.sql.SQLException: Incorrect syntax near 'BUS_SYS_CATG_CD'. ; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred while applying a parameter map. --- Check the AccountMappings.getById-InlineParameterMap. --- Check the statement (query failed). --- Cause: java.sql.SQLException: Incorrect syntax near 'BUS_SYS_CATG_CD'.
>
>
>
> <select id="getById" resultMap="STG1_ACCOUNT_SERVICE_MAPPINGObject" parameterClass="accountServiceSearchObject">
> SELECT BUS_SYS_CATG_CD as BUS_SYS_CATG_CD,
> ACC_SERV_NM as ACC_SERV_NM,
> isnull(ACCT_PRD_ID,-1) as ACCT_PRD_ID
> FROM STG1_ACCOUNT_SERVICE_MAPPING
> <dynamic prepend="WHERE">
> <isNotEmpty property="accServName">
> ACC_SERV_NM = #accServName#
> </isNotEmpty>
> <isNotEmpty prepend=" AND " property="busSysCode">
> BUS_SYS_CATG_CD = #busSysCode#
> </isNotEmpty>
> </dynamic>
> </select>
>
> Any idea what is going on?
> Thanks,
> Ayan
>
I'd suggest enabling tracing for "java.sql" to see the actual
statement being generated and the params used, then duplicate it in a
command line client?
/Gwyn
--
Download Wicket 1.2.2 now! - http://wicketframework.org