if (result.getInt("c") < 2) {
con.setAutoCommit(true);
throw new ProjectNeedsActiveLeaderException();
}
} else {
throw new DAOException();
}
}
String command = "UPDATE `UserTask` SET `Leader` = ? WHERE `ResourceID` = ? AND `ProjectID` = ?";
PreparedStatement statement = con.prepareStatement(command);
statement.setBoolean(1, leader);
statement.setInt(2, resourceID);
statement.setInt(3, projectID);
statement.executeUpdate();
if (!leader) {
con.setAutoCommit(true);
}
} catch (SQLException e) {
throw new DAOException();
}
}