Class EntityModifiedException

All Implemented Interfaces:
Serializable

public final class EntityModifiedException extends UpdateEntityException
An exception indicating that an entity, being updated, has been modified or deleted since it was loaded.

The message, describing the modification, is put together when read, in the language of the reader, see DatabaseException.getMessage() and message(Locale).

See Also:
  • Constructor Details

    • EntityModifiedException

      public EntityModifiedException(Entity entity, @Nullable Entity modified, Collection<Column<?>> columns)
      Instantiates a new EntityModifiedException
      Parameters:
      entity - the entity being updated
      modified - the current (modified) version of the entity, null if it has been deleted
      columns - the modified columns, an empty collection in case the entity has been deleted
  • Method Details

    • entity

      public Entity entity()
      Returns:
      the entity being updated
    • modified

      public Optional<Entity> modified()
      Returns:
      the current (modified) version of the entity, an empty Optional if it has been deleted
    • columns

      public Collection<Column<?>> columns()
      Returns:
      the modified columns, or an empty collection in case the entity has been deleted
    • message

      public @Nullable String message(Locale locale)
      Description copied from class: DatabaseException
      Returns the message in the given locale, for an exception based on an error type, otherwise the message this exception was constructed with, which is not affected by the locale. Useful where the default locale is not the one of the reader, a web server serving users of different languages for example.
      Overrides:
      message in class DatabaseException
      Parameters:
      locale - the locale
      Returns:
      the exception message in the given locale