Exemplo n.º 1
0
  public String getLastCommit(String repositoryId, String branchRef) {
    LOG.debug(
        String.format(
            "Querying local store for last commit in repository %1$s on branch %2$s",
            repositoryId, branchRef));

    Criteria criteria =
        getSession()
            .createCriteria(LastProcessedItem.class)
            // .add(Restrictions.eq("id", LAST_COMMIT_HASH + "||" + repositoryId))
            .add(Restrictions.eq("repositoryId", repositoryId))
            .add(Restrictions.eq("branchRef", branchRef));
    LastProcessedItem result = (LastProcessedItem) criteria.uniqueResult();
    getSession().evict(result);
    return result == null ? null : result.getValue();
  }