ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ayan.x.afr...@jpmchase.com
Subject Re: Dynamic where clause problem
Date Wed, 18 Oct 2006 18:42:45 GMT
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" <gwyn.evans@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 <ayan.x.afridi@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.

Mime
View raw message