-
1. Re: using a greater than or less than sign in ejb-ql where c
dsundstrom Jul 16, 2002 5:15 PM (in response to ddgsilcox)EJB-QL does not allow the use of >, <, >= and <= for all field types. What is the type of the field?
-
2. Re: using a greater than or less than sign in ejb-ql where c
jlisle Jul 16, 2002 5:22 PM (in response to ddgsilcox)
since ejb-jar is an xml file, certain characters need to be escaped. otherwise, there will be parsing errors. the ones i know about are <, >, &, ' and ".
for large sections of xml that need to be escaped, there is a tag called "CDATA"
here is an example from dain sundstrom's JBossCMP document on cmp:
<query-method>
<method-name>findBadDudes_ejbql</method-name>
<method-params>
<method-param>int</method-param>
<method-params>
</query-method>
<ejb-ql><![CDATA[
SELECT OBJECT(g)
FROM gangster g
WHERE g.badness > ?1
]]></ejb-ql>
so, surround your query with <![CDATA[ ....... ]]>
i haven't used this yet, so good luck. -
3. Re: using a greater than or less than sign in ejb-ql where c
ddgsilcox Jul 16, 2002 5:24 PM (in response to ddgsilcox)Ahhh...perhaps that is the problem. This is a java.lang.String java type. I will try it out and post back the results.
FYI: the CDATA tag works just fine, but does not solve the problem. -
4. Re: using a greater than or less than sign in ejb-ql where c
ddgsilcox Jul 16, 2002 5:52 PM (in response to ddgsilcox)Looks like changing the field over to a int allowed the query to parse.
If any developers are watching I suggest a modification to not restrict this for String types. There are valid scenarios for greater than and less than String queries such as name comparison. -
5. Re: using a greater than or less than sign in ejb-ql where c
dsundstrom Jul 17, 2002 11:47 AM (in response to ddgsilcox)What valid scenarios? This seems like a very database specific feature (i.e., it will have different results on different databases).