// static methods for getting by id, etc.
 public static PullRequestDisapproval getPullRequestDisapproval(ActiveObjects ao, PullRequest pr)
     throws SQLException {
   Repository repo = pr.getToRef().getRepository();
   PullRequestDisapproval[] disapprovals =
       ao.find(
           PullRequestDisapproval.class,
           Query.select().where("REPO_ID = ? and PR_ID = ?", repo.getId(), pr.getId()));
   if (disapprovals.length == 0) {
     PullRequestDisapproval prd =
         ao.create(
             PullRequestDisapproval.class,
             new DBParam("REPO_ID", repo.getId()),
             new DBParam("PR_ID", pr.getId()),
             new DBParam("USERNAME", "None"));
     prd.save();
     return prd;
   }
   return disapprovals[0];
 }
 public static void setPullRequestDisapproval(
     ActiveObjects ao, PullRequest pr, String username, boolean isDisapproved)
     throws SQLException {
   Repository repo = pr.getToRef().getRepository();
   PullRequestDisapproval[] disapprovals =
       ao.find(
           PullRequestDisapproval.class,
           Query.select().where("REPO_ID = ? and PR_ID = ?", repo.getId(), pr.getId()));
   if (disapprovals.length == 0) {
     PullRequestDisapproval prd =
         ao.create(
             PullRequestDisapproval.class,
             new DBParam("REPO_ID", repo.getId()),
             new DBParam("PR_ID", pr.getId()),
             new DBParam("USERNAME", username));
     prd.setDisapproved(isDisapproved);
     prd.save();
     return;
   }
   disapprovals[0].setDisapprovedBy(username);
   disapprovals[0].setDisapproved(isDisapproved);
   disapprovals[0].save();
 }
 public void setRepository(Repository repo) {
   prd.setRepositoryId(repo.getId());
 }