I'm trying to perform a query using a join table. I have read the
documentation and several websites. Im stuck
returns: List<Site>
String sql = "SELECT site.* from site, siteservice WHERE " +
"site.id = siteservice.site_id AND " +
"state_id = $stateID AND " +
"siteservice.service_id = $serviceID";
SQLTemplate query = new SQLTemplate(Site.class, sql);
Map parameters = new HashMap();
parameters.put("stateID", stateId);
parameters.put("serviceID", serviceId);
query.setParameters(parameters);
return BaseContext.getThreadObjectContext().performQuery(query);
Table siteservice contains:
site_id
service_id
I can execute the query on the db and i get the results im expecting. Is the
SQLTemplate the correct type to use? What direction should i take?
Thanks for the help.