Interface EntityPersistence


public interface EntityPersistence
Responsible for persisting entities to the database.
  • Method Details

    • insert

      default Entity insert(Entity entity, EntityConnection connection)

      Inserts the given entity into the database using the given connection.

      Parameters:
      entity - the entity to insert
      connection - the connection to use
      Returns:
      the inserted entity
      Throws:
      DatabaseException - in case of a database exception
    • insert

      default Collection<Entity> insert(Collection<Entity> entities, EntityConnection connection)
      Inserts the given entities into the database using the given connection
      Parameters:
      entities - the entities to insert
      connection - the connection to use
      Returns:
      the inserted entities
      Throws:
      DatabaseException - in case of a database exception
    • update

      default Entity update(Entity entity, EntityConnection connection)

      Updates the given entity in the database using the given connection.

      Parameters:
      entity - the entity to update
      connection - the connection to use
      Returns:
      the updated entity
      Throws:
      DatabaseException - in case of a database exception
    • update

      default Collection<Entity> update(Collection<Entity> entities, EntityConnection connection)
      Updates the given entities in the database using the given connection
      Parameters:
      entities - the entities to update
      connection - the connection to use
      Returns:
      the updated entities
      Throws:
      DatabaseException - in case of a database exception
    • delete

      default void delete(Entity entity, EntityConnection connection)

      Deletes the given entity from the database using the given connection.

      Parameters:
      entity - the entity to delete
      connection - the connection to use
      Throws:
      DatabaseException - in case of a database exception
    • delete

      default void delete(Collection<Entity> entities, EntityConnection connection)
      Deletes the given entities from the database using the given connection
      Parameters:
      entities - the entities to delete
      connection - the connection to use
      Throws:
      DatabaseException - in case of a database exception
    • replaceable

      default boolean replaceable()
      Specifies whether this EntityPersistence instance is replaceable, default true
      Returns:
      true if this instance is replaceable