class JDBCConnection implements ObjectStoreConnection {

    public String generateDomainTemplateVersionQuery(Map<String, Integer> templateNameAndLatestVersion) {
        StringBuilder query = new StringBuilder();
        query.append("SELECT domain.name, domain_template.template FROM domain_template " +
                "JOIN domain ON domain_template.domain_id=domain.domain_id WHERE ");
        for (String templateName : templateNameAndLatestVersion.keySet()) {
            query.append("(domain_template.template = '").append(templateName).append("' and current_version < ")
                    .append(templateNameAndLatestVersion.get(templateName)).append(") OR ");
        }
        //To remove the last occurrence of "OR" from the generated query
        query.delete(query.lastIndexOf(") OR"), query.lastIndexOf("OR") + 3).append(");");
        return query.toString();
    }

    public  JDBCConnection(Connection con, boolean autoCommit);

}