IBATIS - inserting literals (removing quotes from your sql)
When using IBATIS, use $parameter$ to inject literals in your sql maps. For instance, if you have a sql query that injects a comma separated list of ids, using #parameter# will put quotes in the sql, causing an error if you were using the “in” operator. Using $parameter$ removes the quotes and your sql is content.
Example with #:
select filter.id from filter where filtertypeid = #filterTypeId# and typeid in (#typeIds#);
could yield
select filter.id from filter where filtertypeid = '2' and typeid in ('0,1,4');
Example with $:
select filter.id from filter where filtertypeid = #filterTypeId# and typeid in ($typeIds$);
could yield
select filter.id from filter where filtertypeid = '2' and typeid in (0,1,4);
Conclusion:
Remember to use your dollar signs.