tags:

views:

599

answers:

3

Let's say in my sql statement I want to do:

WHERE numberOfCookies >= 10 

How do I do this in iBatis?

A: 

Is this what you want?

<isGreaterEqual prepend="AND" 
             property="numberOfCookies" 
             compareValue="10">
BIGFOOT = ‘TRUE'
</isGreaterEqual>

See Dynamic SQL at ibatis.apache.org.

Peter Lang
Not quite, I made the rookie mistake of forgetting I was working in xml. But thanks :)
Stephane Grenier
+2  A: 

Because the SQL is written in xml, you cannot just use the symbol ">", you need to write it as:

WHERE numberOfCookies &lt;= 10
Stephane Grenier
+2  A: 

Why does it not work?

The only thing I can think of is that the > character isn't playing nice with the XML. In which case, you can wrap the entire statement within <![CDATA[ ... ]]>

Tinister
that's true unless you're also adding values for iBatis such as "WHERE numberOfCookies <= #value#"
Stephane Grenier