Example #1
0
  public void persistLastCommit(String commitHash, String repositoryId, String branchRef) {
    LOG.debug(
        String.format(
            "Persisting to local store commit %1$s in repository %2$s on branch %3$s",
            commitHash, repositoryId, branchRef));

    LastProcessedItem lastHash = new LastProcessedItem();
    // lastHash.setId(LAST_COMMIT_HASH + "||" + repositoryId);
    lastHash.setRepositoryId(repositoryId);
    lastHash.setBranchRef(branchRef);
    lastHash.setValue(commitHash);

    Transaction tr = getSession().beginTransaction();
    getSession().saveOrUpdate(lastHash);
    tr.commit();
    getSession().flush();
  }