ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Maves" <nathan.ma...@gmail.com>
Subject Re: Need Help on Complex WHERE CLAUSE
Date Fri, 07 Mar 2008 00:23:47 GMT
Tony,

This is correct if you are using parameter maps.  If you are using inline
paramter maps you would still use #rx#.

Nathan

On Thu, Mar 6, 2008 at 1:48 PM, Angso, Tony <Tony_Angso@medco.com> wrote:

> I found the problem...
>
>                WHERE RXNUM_TXT =   #rx#
>                   AND LOCATION_CDE = #loc#
>
> Should be replaced with
>
>                WHERE RXNUM_TXT =  ?
>                   AND LOCATION_CDE = ?
>
>
> And it work...
> Am new to ibatis and currently just playing with it... So thanks for all
> for answering my "newbie" question...
>
> Thanks
>
>
> Tony
>
>
> -----Original Message-----
> From: Angso, Tony
> Sent: Thursday, March 06, 2008 3:09 PM
> To: 'user-java@ibatis.apache.org'
> Subject: RE: Need Help on Complex WHERE CLAUSE
>
>
> Found the error, my sqlMap object is poitning to a different instance of
> Oracle Database, hence it can't find the table... So I fixed that... Now
> it shows a different error..
>
> [3/6/08 15:01:53:682 EST] 00000026 SystemErr     R
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in WEB-INF/config/uv_sqlmap.xml.
> --- The error occurred while applying a parameter map.
> --- Check the rxlocParam.
> --- Check the statement (query failed).
> --- Cause: java.sql.SQLException: ORA-00911: invalid character
>
>  <?xml version="1.0" encoding="UTF-8"?>
>  <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
>  "http://ibatis.apache.org/dtd/sql-map-2.dtd">
>  <sqlMap>
>
>        <parameterMap id="rxlocParam" class="map">
>                <parameter property="rx" jdbcType="VARCHAR"
>  javaType="java.lang.String" />
>                <parameter property="loc" jdbcType="VARCHAR"
>  javaType="java.lang.String" />
>        </parameterMap>
>        <select id="getEISPolyScript" parameterMap="rxlocParam"
>  resultClass="java.util.HashMap">
>                SELECT F_DOCNUMBER_ID, TIFF_DOC_ID, DOC_COMMITTAL_DTE,
> F_LIBRARY_ID
>                FROM IM_RX
>                WHERE RXNUM_TXT =   #rx#
>                   AND LOCATION_CDE = #loc#
>        </select>
>  </sqlMap>
>
> What is the invalid character????
>
> With the above sqlMap,
>
> Map map = new HashMap();
> map.put("rx", "0101402722");
> map.put("loc","03");
>
> list = sqlMap.queryForList("getEISPolyScript", map); // <-- error here
> System.out.println("Selected " + list.size() + " records.");
>
> Is it allowed to use sqlMap.queryForList()?
>
> Thanks for all the patience...
>
> Tony
>
>
>
> -----Original Message-----
> From: Jared Blitzstein [mailto:mailing-list@blitzstein.net]
> Sent: Thursday, March 06, 2008 2:46 PM
> To: user-java@ibatis.apache.org
> Subject: Re: Need Help on Complex WHERE CLAUSE
>
>
> Here is a silly question, but did you investigate "--- Cause:
> java.sql.SQLException: ORA-00942: table or view does exist" not at
> all? Turn on log4j and see what statement it's executing.
>
>
> On Mar 6, 2008, at 2:42 PM, Angso, Tony wrote:
>
> > Am trying to pass a complex WHERE CLAUSE
> >
> > sqlMap is
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
> > "http://ibatis.apache.org/dtd/sql-map-2.dtd">
> > <sqlMap>
> >
> >       <parameterMap id="rxlocParam" class="map">
> >               <parameter property="rx" jdbcType="VARCHAR"
> > javaType="java.lang.String" />
> >               <parameter property="loc" jdbcType="VARCHAR"
> > javaType="java.lang.String" />
> >       </parameterMap>
> >       <select id="getEISPolyScript" parameterMap="rxlocParam"
> > resultClass="java.util.HashMap">
> >               SELECT F_DOCNUMBER_ID, TIFF_DOC_ID, DOC_COMMITTAL_DTE,
> F_LIBRARY_ID
> >               FROM IM_RX
> >               WHERE RXNUM_TXT =   #rx#
> >                  AND LOCATION_CDE = #loc#
> >       </select>
> > </sqlMap>
> >
> > Java code is
> >               Map map = new HashMap();
> >               map.put("rx", "0101402722");
> >               map.put("loc","03");
> >
> >               list = sqlMap.queryForList("getEISPolyScript", map);
> > // <-- error here
> >               System.out.println("Selected " + list.size() + "
> records.");
> >
> >
> >
> > Getting this error
> > [3/6/08 14:25:17:541 EST] 00000026 SystemErr     R
> > com.ibatis.common.jdbc.exception.NestedSQLException:
> > --- The error occurred in WEB-INF/config/uv_sqlmap.xml.
> > --- The error occurred while applying a parameter map.
> > --- Check the getEISPolyScript-InlineParameterMap.
> > --- Check the statement (query failed).
> > --- Cause: java.sql.SQLException: ORA-00942: table or view does not
> > exist
> >
> >
> > Thanks for any help.
> >
> > Tony
>
>
> -----------------------------------------
> This e-mail message and any attachments contain confidential
> information from Medco. If you are not the intended recipient, you
> are hereby notified that disclosure, printing, copying,
> distribution, or the taking of any action in reliance on the
> contents of this electronic information is strictly prohibited. If
> you have received this e-mail message in error, please immediately
> notify the sender by reply message and then delete the electronic
> message and any attachments.
>

Mime
View raw message