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 jrhitokiri <jr...@gmail.com> on 2009/10/14 10:20:51 UTC
can IBATIS handle mysql "DATE" keyword?
I have this query I tested in mysql. it works when I type it and use example
input:
CODE:
select * from eservations where
(DATE(start) < DATE(input_start) AND
DATE(input_start) < DATE(END))
OR
(DATE(start) < DATE(input_end) AND
DATE(input_end) < DATE(end))
the thing is, ibatis throws an exception when I add it to my xml file:
CODE:
<select id="getPossibleConflicts"
parameterClass="iReserveClasses.Reservations"
resultClass="iReserveClasses.Reservations">
select * from reservations where ((DATE(start) < DATE(#start#)) AND
(DATE(#start#) < DATE(end))) OR ((DATE(start) < DATE(#end#)) AND
(DATE(#end#) < DATE(end)))
</select>
Now I know it's this particular query that does not work, because when I
take it out, no exceptions are thrown. Is there something wrong with this
query? Or can Ibatis use the "Date" keyword?
ERROR SNAPSHOT:
java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.
Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause:
org.xml.sax.SAXParseException: The content of elements must consist of
well-formed character data or markup.
at
com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:123)
...
Please, I need your help with this. Thanks.
kind regards
JR
--
View this message in context: http://www.nabble.com/can-IBATIS-handle-mysql-%22DATE%22-keyword--tp25887145p25887145.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: can IBATIS handle mysql "DATE" keyword?
Posted by Ed Stafford <wa...@carbonsixty.co.uk>.
The required escape characters for xml are:
" "
' '
< <
> >
& &
Your problem isn't so much with iBatis xml config as it is with the general
requirements of well formed xml.
Cheers,
-Ed
2009/10/14 meindert <me...@eduflex.com>
> Off the top of my head that would be <, # and $
>
> -----Original Message-----
> From: jrhitokiri [mailto:jrhitokiri@gmail.com]
> Sent: 14 October 2009 01:02 PM
> To: user-java@ibatis.apache.org
> Subject: RE: can IBATIS handle mysql "DATE" keyword?
>
>
> I tried it. It works now. Wow, and I was stumped on that for an hour before
> I
> decided to post here. this helped a lot! Thanks!
>
> But anyway, aside from the greater than and less than symbols, what other
> symbols need escaping? so that I'll know when to use this again.
>
>
> Niels Beekman-2 wrote:
> >
> > Did you try it? Looks like it should work.
> >
> > -----Original Message-----
> > From: jrhitokiri [mailto:jrhitokiri@gmail.com]
> > Sent: Wednesday, October 14, 2009 12:11 PM
> > To: user-java@ibatis.apache.org
> > Subject: Re: can IBATIS handle mysql "DATE" keyword?
> >
> >
> > will this be okay:
> >
> >
> > CODE:
> > <select id="getPossibleConflicts"
> > parameterClass="iReserveClasses.Reservations"
> > resultClass="iReserveClasses.Reservations">
> > <![CDATA[
> >
> > select * from reservations where ((DATE(start) < DATE(#start#))
> > AND
> > (DATE(#start#) < DATE(end))) OR ((DATE(start) < DATE(#end#)) AND
> > (DATE(#end#) < DATE(end)))
> > ]]>
> >
> > </select>
> >
> >
> > Regards,
> > JR
> >
> >
> > Ed Stafford-3 wrote:
> >>
> >> You could also wrap it in CDATA block if you don't want to deal with
> >> escaping everything (http://www.w3schools.com/xmL/xml_cdata.asp).
> >>
> >> -Ed
> >>
> >> 2009/10/14 Niels Beekman <n....@wis.nl>
> >>
> >>
> >
> > --
> > View this message in context:
> > http://www.nabble.com/can-IBATIS-handle-mysql-%22DATE%22-keyword--tp2588
> > 7145p25888427.html
> > Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> > For additional commands, e-mail: user-java-help@ibatis.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> > For additional commands, e-mail: user-java-help@ibatis.apache.org
> >
> >
> >
>
> --
> View this message in context:
>
> http://www.nabble.com/can-IBATIS-handle-mysql-%22DATE%22-keyword--tp25887145
> p25888996.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.421 / Virus Database: 270.14.15/2434 - Release Date: 10/13/09
> 19:11:00
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
RE: can IBATIS handle mysql "DATE" keyword?
Posted by meindert <me...@eduflex.com>.
Off the top of my head that would be <, # and $
-----Original Message-----
From: jrhitokiri [mailto:jrhitokiri@gmail.com]
Sent: 14 October 2009 01:02 PM
To: user-java@ibatis.apache.org
Subject: RE: can IBATIS handle mysql "DATE" keyword?
I tried it. It works now. Wow, and I was stumped on that for an hour before
I
decided to post here. this helped a lot! Thanks!
But anyway, aside from the greater than and less than symbols, what other
symbols need escaping? so that I'll know when to use this again.
Niels Beekman-2 wrote:
>
> Did you try it? Looks like it should work.
>
> -----Original Message-----
> From: jrhitokiri [mailto:jrhitokiri@gmail.com]
> Sent: Wednesday, October 14, 2009 12:11 PM
> To: user-java@ibatis.apache.org
> Subject: Re: can IBATIS handle mysql "DATE" keyword?
>
>
> will this be okay:
>
>
> CODE:
> <select id="getPossibleConflicts"
> parameterClass="iReserveClasses.Reservations"
> resultClass="iReserveClasses.Reservations">
> <![CDATA[
>
> select * from reservations where ((DATE(start) < DATE(#start#))
> AND
> (DATE(#start#) < DATE(end))) OR ((DATE(start) < DATE(#end#)) AND
> (DATE(#end#) < DATE(end)))
> ]]>
>
> </select>
>
>
> Regards,
> JR
>
>
> Ed Stafford-3 wrote:
>>
>> You could also wrap it in CDATA block if you don't want to deal with
>> escaping everything (http://www.w3schools.com/xmL/xml_cdata.asp).
>>
>> -Ed
>>
>> 2009/10/14 Niels Beekman <n....@wis.nl>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/can-IBATIS-handle-mysql-%22DATE%22-keyword--tp2588
> 7145p25888427.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
>
--
View this message in context:
http://www.nabble.com/can-IBATIS-handle-mysql-%22DATE%22-keyword--tp25887145
p25888996.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.421 / Virus Database: 270.14.15/2434 - Release Date: 10/13/09
19:11:00
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
RE: can IBATIS handle mysql "DATE" keyword?
Posted by jrhitokiri <jr...@gmail.com>.
I tried it. It works now. Wow, and I was stumped on that for an hour before I
decided to post here. this helped a lot! Thanks!
But anyway, aside from the greater than and less than symbols, what other
symbols need escaping? so that I'll know when to use this again.
Niels Beekman-2 wrote:
>
> Did you try it? Looks like it should work.
>
> -----Original Message-----
> From: jrhitokiri [mailto:jrhitokiri@gmail.com]
> Sent: Wednesday, October 14, 2009 12:11 PM
> To: user-java@ibatis.apache.org
> Subject: Re: can IBATIS handle mysql "DATE" keyword?
>
>
> will this be okay:
>
>
> CODE:
> <select id="getPossibleConflicts"
> parameterClass="iReserveClasses.Reservations"
> resultClass="iReserveClasses.Reservations">
> <![CDATA[
>
> select * from reservations where ((DATE(start) < DATE(#start#))
> AND
> (DATE(#start#) < DATE(end))) OR ((DATE(start) < DATE(#end#)) AND
> (DATE(#end#) < DATE(end)))
> ]]>
>
> </select>
>
>
> Regards,
> JR
>
>
> Ed Stafford-3 wrote:
>>
>> You could also wrap it in CDATA block if you don't want to deal with
>> escaping everything (http://www.w3schools.com/xmL/xml_cdata.asp).
>>
>> -Ed
>>
>> 2009/10/14 Niels Beekman <n....@wis.nl>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/can-IBATIS-handle-mysql-%22DATE%22-keyword--tp2588
> 7145p25888427.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/can-IBATIS-handle-mysql-%22DATE%22-keyword--tp25887145p25888996.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
RE: can IBATIS handle mysql "DATE" keyword?
Posted by Niels Beekman <n....@wis.nl>.
Did you try it? Looks like it should work.
-----Original Message-----
From: jrhitokiri [mailto:jrhitokiri@gmail.com]
Sent: Wednesday, October 14, 2009 12:11 PM
To: user-java@ibatis.apache.org
Subject: Re: can IBATIS handle mysql "DATE" keyword?
will this be okay:
CODE:
<select id="getPossibleConflicts"
parameterClass="iReserveClasses.Reservations"
resultClass="iReserveClasses.Reservations">
<![CDATA[
select * from reservations where ((DATE(start) < DATE(#start#))
AND
(DATE(#start#) < DATE(end))) OR ((DATE(start) < DATE(#end#)) AND
(DATE(#end#) < DATE(end)))
]]>
</select>
Regards,
JR
Ed Stafford-3 wrote:
>
> You could also wrap it in CDATA block if you don't want to deal with
> escaping everything (http://www.w3schools.com/xmL/xml_cdata.asp).
>
> -Ed
>
> 2009/10/14 Niels Beekman <n....@wis.nl>
>
>
--
View this message in context:
http://www.nabble.com/can-IBATIS-handle-mysql-%22DATE%22-keyword--tp2588
7145p25888427.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: can IBATIS handle mysql "DATE" keyword?
Posted by jrhitokiri <jr...@gmail.com>.
will this be okay:
CODE:
<select id="getPossibleConflicts"
parameterClass="iReserveClasses.Reservations"
resultClass="iReserveClasses.Reservations">
<![CDATA[
select * from reservations where ((DATE(start) < DATE(#start#))
AND
(DATE(#start#) < DATE(end))) OR ((DATE(start) < DATE(#end#)) AND
(DATE(#end#) < DATE(end)))
]]>
</select>
Regards,
JR
Ed Stafford-3 wrote:
>
> You could also wrap it in CDATA block if you don't want to deal with
> escaping everything (http://www.w3schools.com/xmL/xml_cdata.asp).
>
> -Ed
>
> 2009/10/14 Niels Beekman <n....@wis.nl>
>
>
--
View this message in context: http://www.nabble.com/can-IBATIS-handle-mysql-%22DATE%22-keyword--tp25887145p25888427.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: can IBATIS handle mysql "DATE" keyword?
Posted by Ed Stafford <wa...@carbonsixty.co.uk>.
You could also wrap it in CDATA block if you don't want to deal with
escaping everything (http://www.w3schools.com/xmL/xml_cdata.asp).
-Ed
2009/10/14 Niels Beekman <n....@wis.nl>
> You should escape your < and >.
>
> Niels
>
> -----Original Message-----
> From: jrhitokiri [mailto:jrhitokiri@gmail.com]
> Sent: Wednesday, October 14, 2009 10:21 AM
> To: user-java@ibatis.apache.org
> Subject: can IBATIS handle mysql "DATE" keyword?
>
>
> I have this query I tested in mysql. it works when I type it and use
> example
> input:
>
> CODE:
> select * from eservations where
> (DATE(start) < DATE(input_start) AND
> DATE(input_start) < DATE(END))
>
> OR
>
> (DATE(start) < DATE(input_end) AND
> DATE(input_end) < DATE(end))
>
> the thing is, ibatis throws an exception when I add it to my xml file:
>
> CODE:
> <select id="getPossibleConflicts"
> parameterClass="iReserveClasses.Reservations"
> resultClass="iReserveClasses.Reservations">
> select * from reservations where ((DATE(start) < DATE(#start#))
> AND
> (DATE(#start#) < DATE(end))) OR ((DATE(start) < DATE(#end#)) AND
> (DATE(#end#) < DATE(end)))
> </select>
>
> Now I know it's this particular query that does not work, because when I
> take it out, no exceptions are thrown. Is there something wrong with
> this
> query? Or can Ibatis use the "Date" keyword?
>
> ERROR SNAPSHOT:
> java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.
> Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.
> Cause:
> org.xml.sax.SAXParseException: The content of elements must consist of
> well-formed character data or markup.
> at
> com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:12
> 3)
> ...
>
> Please, I need your help with this. Thanks.
>
> kind regards
> JR
> --
> View this message in context:
> http://www.nabble.com/can-IBATIS-handle-mysql-%22DATE%22-keyword--tp2588
> 7145p25887145.html<http://www.nabble.com/can-IBATIS-handle-mysql-%22DATE%22-keyword--tp2588%0A7145p25887145.html>
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
RE: can IBATIS handle mysql "DATE" keyword?
Posted by Niels Beekman <n....@wis.nl>.
You should escape your < and >.
Niels
-----Original Message-----
From: jrhitokiri [mailto:jrhitokiri@gmail.com]
Sent: Wednesday, October 14, 2009 10:21 AM
To: user-java@ibatis.apache.org
Subject: can IBATIS handle mysql "DATE" keyword?
I have this query I tested in mysql. it works when I type it and use
example
input:
CODE:
select * from eservations where
(DATE(start) < DATE(input_start) AND
DATE(input_start) < DATE(END))
OR
(DATE(start) < DATE(input_end) AND
DATE(input_end) < DATE(end))
the thing is, ibatis throws an exception when I add it to my xml file:
CODE:
<select id="getPossibleConflicts"
parameterClass="iReserveClasses.Reservations"
resultClass="iReserveClasses.Reservations">
select * from reservations where ((DATE(start) < DATE(#start#))
AND
(DATE(#start#) < DATE(end))) OR ((DATE(start) < DATE(#end#)) AND
(DATE(#end#) < DATE(end)))
</select>
Now I know it's this particular query that does not work, because when I
take it out, no exceptions are thrown. Is there something wrong with
this
query? Or can Ibatis use the "Date" keyword?
ERROR SNAPSHOT:
java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.
Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.
Cause:
org.xml.sax.SAXParseException: The content of elements must consist of
well-formed character data or markup.
at
com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:12
3)
...
Please, I need your help with this. Thanks.
kind regards
JR
--
View this message in context:
http://www.nabble.com/can-IBATIS-handle-mysql-%22DATE%22-keyword--tp2588
7145p25887145.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org