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 Thomas Rene Vervik <th...@gmail.com> on 2007/12/10 13:53:38 UTC

< and > comparison in sql queries are not accepted by ibatis

Hello

I am doing a query like this:
	<statement id="getTurnover" resultClass="dbBeans.TurnoverHolder">
  		SELECT SUM(STAT01_04.ST0104_ACC01)  as result
		FROM STAT01_04
		WHERE STAT01_04.ST0104_DIM04 > #fromDate#
		AND STAT01_04.ST0104_DIM04 < #toDate#
	</statement>

but ibatis give me an error that it cant parse the sqlMap. Just to eliminate
all misunderstandings: the query works if I replace the > signs with =, so
the parse problems in not anywhere else in the document.

So my question would be - how do you manage to make < and > comparisons in
queries using ibatis ?

Thanks for all suggestions
Best regards
Thomas Vervik
-- 
View this message in context: http://www.nabble.com/%3C---and---%3E-comparison-in-sql-queries-are-not-accepted-by-ibatis-tp14252091p14252091.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: < and > comparison in sql queries are not accepted by ibatis

Posted by Chetan Nayak <ch...@gmail.com>.
Use CDATA

On 12/10/07, Thomas Rene Vervik <th...@gmail.com> wrote:
>
>
> Hello
>
> I am doing a query like this:
>        <statement id="getTurnover" resultClass="dbBeans.TurnoverHolder">
>                SELECT SUM(STAT01_04.ST0104_ACC01)  as result
>                FROM STAT01_04
>                WHERE STAT01_04.ST0104_DIM04 > #fromDate#
>                AND STAT01_04.ST0104_DIM04 < #toDate#
>        </statement>
>
> but ibatis give me an error that it cant parse the sqlMap. Just to
> eliminate
> all misunderstandings: the query works if I replace the > signs with =, so
> the parse problems in not anywhere else in the document.
>
> So my question would be - how do you manage to make < and > comparisons in
> queries using ibatis ?
>
> Thanks for all suggestions
> Best regards
> Thomas Vervik
> --
> View this message in context:
> http://www.nabble.com/%3C---and---%3E-comparison-in-sql-queries-are-not-accepted-by-ibatis-tp14252091p14252091.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Re: < and > comparison in sql queries are not accepted by ibatis

Posted by Thomas Rene Vervik <th...@gmail.com>.
ahh, stupid me. My fault, forgot I was in xml world

Thanks to both for your help

have a splended day
best regards
Thomas


Larry Meadors-2 wrote:
> 
> Standard xml escaping: &lt; and &gt;
> 
> Larry
> 
> 
> On Dec 10, 2007 5:53 AM, Thomas Rene Vervik <th...@gmail.com>
> wrote:
>>
>> Hello
>>
>> I am doing a query like this:
>>         <statement id="getTurnover" resultClass="dbBeans.TurnoverHolder">
>>                 SELECT SUM(STAT01_04.ST0104_ACC01)  as result
>>                 FROM STAT01_04
>>                 WHERE STAT01_04.ST0104_DIM04 > #fromDate#
>>                 AND STAT01_04.ST0104_DIM04 < #toDate#
>>         </statement>
>>
>> but ibatis give me an error that it cant parse the sqlMap. Just to
>> eliminate
>> all misunderstandings: the query works if I replace the > signs with =,
>> so
>> the parse problems in not anywhere else in the document.
>>
>> So my question would be - how do you manage to make < and > comparisons
>> in
>> queries using ibatis ?
>>
>> Thanks for all suggestions
>> Best regards
>> Thomas Vervik
>> --
>> View this message in context:
>> http://www.nabble.com/%3C---and---%3E-comparison-in-sql-queries-are-not-accepted-by-ibatis-tp14252091p14252091.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/%3C---and---%3E-comparison-in-sql-queries-are-not-accepted-by-ibatis-tp14252091p14253170.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: < and > comparison in sql queries are not accepted by ibatis

Posted by Larry Meadors <lm...@apache.org>.
Standard xml escaping: &lt; and &gt;

Larry


On Dec 10, 2007 5:53 AM, Thomas Rene Vervik <th...@gmail.com> wrote:
>
> Hello
>
> I am doing a query like this:
>         <statement id="getTurnover" resultClass="dbBeans.TurnoverHolder">
>                 SELECT SUM(STAT01_04.ST0104_ACC01)  as result
>                 FROM STAT01_04
>                 WHERE STAT01_04.ST0104_DIM04 > #fromDate#
>                 AND STAT01_04.ST0104_DIM04 < #toDate#
>         </statement>
>
> but ibatis give me an error that it cant parse the sqlMap. Just to eliminate
> all misunderstandings: the query works if I replace the > signs with =, so
> the parse problems in not anywhere else in the document.
>
> So my question would be - how do you manage to make < and > comparisons in
> queries using ibatis ?
>
> Thanks for all suggestions
> Best regards
> Thomas Vervik
> --
> View this message in context: http://www.nabble.com/%3C---and---%3E-comparison-in-sql-queries-are-not-accepted-by-ibatis-tp14252091p14252091.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Re: < and > comparison in sql queries are not accepted by ibatis

Posted by Graeme J Sweeney <ib...@gjsweeney.com>.
On Mon, 10 Dec 2007, Thomas Rene Vervik wrote:

> So my question would be - how do you manage to make < and > comparisons in
> queries using ibatis ?

You're dealing with XML, so use CDATA sections or entities &lt; and &gt;

< &lt;
> &gt;

-- 
Graeme -