Hi Allard,
while playing around with aggregate versions i found the following code in AbstractRepository:
protected void validateOnLoad(T aggregate, Long expectedVersion) {
if (expectedVersion != null && aggregate.getVersion() != null && aggregate.getVersion() > expectedVersion) {
throw new ConflictingAggregateVersionException(aggregate.getIdentifier(),
expectedVersion,
aggregate.getVersion());
}
}
Shouldn't the ConflictingAggregateVersionException be thrown when aggregate.getVersion() != expectedVersion? At least the source comment at repository.load() says so.
So the check seems wrong to me as a bad client will ever win if it chooses a very high version number.
Cheers
Marcus