| Author |
Special characters in hql
|
Ryan Waggoner
Ranch Hand
Joined: Jun 27, 2007
Posts: 75
|
|
Hey guys,
I have a bunch of hql statements that my site uses. Often these queries are made from input on the web page. For something like a description field it is not unusual to have an apostrophe (') in the query. SQL does not like this one bit, and yells at me for it every time.
Any suggestions on how I would go about putting an escape character in for an ' every time it appeared in the query?
(with out putting an if statement on each hql statement )
Thanks!
|
 |
Reehan Lalkhanwar
Ranch Hand
Joined: Jun 16, 2007
Posts: 106
|
|
Append a special character before the quote and tell the DB that as the escape character.
|
Thank you,
Reehan
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Use parameter binding.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
 |
|
|
subject: Special characters in hql
|
|
|