cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Fraser <m...@mark100.net>
Subject Apostrophe escaping in select
Date Thu, 12 Feb 2009 04:45:20 GMT
hello,

I am using Cayenne 2.0.4 in a standalone application with Derby embedded.

The following code breaks for obvious reasons when there is an 
apostrophe ("'") in the person's name.

---------

SQLTemplate template = new SQLTemplate(Person.class, "SELECT * FROM 
people where country_id=" + String.valueOf(country.getId()) + " and 
name='" + name + "'");

List res = dataContext().performQuery(template);
---------

What is the best (Cayenne specific or otherwise) approach to dealing 
with this problem?

Thanks


Mime
View raw message