Escaping the & (ampersand) character

18 views
Skip to first unread message

GregW

unread,
Apr 19, 2012, 11:32:25 AM4/19/12
to mybatis-user
I have an xml select query like this:

select unique office
from organizations
where organization = #{org} and department = #{dept}

In my case, some of the department values may contain the character
'&' in them. Examining the logs, the org and dept get filled in with
the correct values, however the dept which contains a '&' I guess is
not being escaped and therefore is not a legal SQL query. Is there a
way around this? Am I missing something?

-Greg

Eduardo Macarron

unread,
Apr 19, 2012, 11:38:18 AM4/19/12
to mybati...@googlegroups.com
Hi Greg, I am not sure I understood the problem. Could you post the log?

GregW

unread,
Apr 19, 2012, 11:51:46 AM4/19/12
to mybatis-user
Sorry, apparently it does work. My colleague was experiencing some
difficulties but I see that myBatis is doing the correct thing.

-Greg

On Apr 19, 11:38 am, Eduardo Macarron <eduardo.macar...@gmail.com>
wrote:
> Hi Greg, I am not sure I understood the problem. Could you post the log?
>
Reply all
Reply to author
Forward
0 new messages