Configuration.getConnectionPool().executeInsertOrUpdate(qpp);
}
catch( SQLException e )
{
Logger.error("SQLException prevented role2user record deletion", e);
throw new RoleUpdateAddException(
"SQLException prevented role2user record deletion: "
+ e.getMessage());
}
// update user roles
//get roleId's
int[] roleIds = getRoleIdsByNames(user.getRoles());
StringBuffer sql = new StringBuffer();
for( int i = 0; i < roleIds.length; i++ )
{
sql.append(" insert into role2user ");
sql.append(" ( user_id, role_id ) ");
sql.append(" values ");
sql.append(" ( ?, ?) ");
QueryParser qp = new QueryParser(sql.toString());
qp.addPreparedStmtElementDefinition(user.getUserId());
qp.addPreparedStmtElementDefinition( roleIds[i]);
try
{
Configuration.getConnectionPool().executeInsertOrUpdate(qp);
}
catch( SQLException e )
{
Logger.error("SQLException prevented role2user record update", e);
throw new RoleUpdateAddException(
"SQLException prevented top role2user record update: "
+ e.getMessage());
}
sql = new StringBuffer();
}