public List<RoleConfiguration> getRoleConfigurationsByOrganizationsAndSql(List<Organizations> organizations){
List<RoleConfiguration> roleList = null;
// select * from roleconfiguration r where r.`OrganizationId` in (1,2)
String sql = "select * from roleconfiguration r where r.OrganizationId in (";
for (Organizations org : organizations) {
sql += org.getId()+",";
} // select * from roleconfiguration r where r.`OrganizationId` in (1,2,
if(sql.endsWith(",")){
sql = sql.substring(0, sql.length() -1); // select * from roleconfiguration r where r.`OrganizationId` in (1,2
}
sql += ")"; select * from roleconfiguration r where r.`OrganizationId` in (1,2)
roleList = this.findBySql(sql);
return roleList;
}
public List<RoleConfiguration> getRoleConfigurationsByOrganizationsAndHql(List<Organizations> organizations){
List<RoleConfiguration> roleList = null;
String hql = " select r from RoleConfiguration r where r.organizations.id in (";
for (Organizations org : organizations) {
hql += org.getId()+",";
}
if(hql.endsWith(",")){
hql = hql.substring(0, hql.length()-1);
}
hql += ")";
roleList = this.executeQueryByHQL(hql, null);
return roleList;
}