@Override public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } Commit other = (Commit) o; return this.getId().equals(other.getId()); }
public boolean isPersisted(Commit commit) { SelectQuery selectQuery = polyJDBC .query() .select("count(*)") .from(COMMIT_TABLE_NAME) .where(COMMIT_COMMIT_ID + " = :id") .withArgument("id", commit.getId().valueAsNumber()); return PolyUtil.queryForOptionalLong(selectQuery, polyJDBC).get() > 0; }
@Override public void persist(Commit commit) { if (commitRepository.isPersisted(commit)) { throw new JaversException( JaversExceptionCode.CANT_SAVE_ALREADY_PERSISTED_COMMIT, commit.getId()); } long commitPk = commitRepository.save( commit.getAuthor(), commit.getProperties(), commit.getCommitDate(), commit.getId()); cdoSnapshotRepository.save(commitPk, commit.getSnapshots()); }