Package org.axonframework.eventsourcing
Class EntityMissingAfterLoadOrCreateException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.axonframework.eventsourcing.EntityMissingAfterLoadOrCreateException
- All Implemented Interfaces:
Serializable
Exception thrown by the
is
EventSourcedEntityFactory when the entity returned by
invalid reference
EventSourcedEntityFactory#create(Object, EventMessage)
null when calling it with a null
firstEventMessage during the EventSourcingRepository.loadOrCreate(Object, ProcessingContext).
This indicates that the factory is incapable of creating an entity without an event message, as is the case with
entities that only have a constructor that takes an event message or its payload. If this is the case, the
EventSourcingRepository.load(Object, ProcessingContext) should be used instead, which will leave the entity
as null if no events are found.
If the entity has a constructor that takes no arguments or an identifier, the factory should be adjusted to return a non-null entity when no event message is present.
- Since:
- 5.0.0
- Author:
- Mitchell Herrijgers
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEntityMissingAfterLoadOrCreateException(Object identifier) Constructs the exception with the givenidentifier. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
EntityMissingAfterLoadOrCreateException
Constructs the exception with the givenidentifier.- Parameters:
identifier- The identifier of the entity that was attempted to be loaded or created.
-