MassUpdate massUpdate = context.prepareMassUpdate();
massUpdate.select("SELECT i.id FROM issues i " +
"INNER JOIN projects p on p.id=i.component_id " +
"WHERE p.enabled=? AND i.resolution IS NULL ").setBoolean(1, false);
massUpdate.update("UPDATE issues SET status=?,resolution=?,updated_at=? WHERE id=?");
massUpdate.execute(new MassUpdate.Handler() {
@Override
public boolean handle(Select.Row row, SqlStatement update) throws SQLException {
Long id = row.getLong(1);
update.setString(1, Issue.STATUS_CLOSED);
update.setString(2, Issue.RESOLUTION_REMOVED);