DATACMNS-957 - AuditingHandler now works with entities without an identifier.

Entities without an identifier previously an exception because the IsNewStrategyFactory wasn't able to determine a strategy even if there was no auditing to be applied in the first place.

We now eagerly check for auditability and skip the lookup for an IsNewStrategy completely in case that check returns false.

Related pull request: #189.
This commit is contained in:
Oliver Gierke
2016-12-14 13:54:01 +01:00
parent 74426c01e1
commit e3b7bb8b01
3 changed files with 18 additions and 1 deletions

View File

@@ -92,8 +92,15 @@ public class IsNewAwareAuditingHandlerUnitTests extends AuditingHandlerUnitTests
handler.markModified(null);
}
@Test // DATACMNS-957
public void skipsEntityWithoutIdentifier() {
getHandler().markAudited(new EntityWithoutId());
}
static class Domain {
@Id Long id;
}
static class EntityWithoutId {}
}