Class Entity

java.lang.Object
org.springframework.batch.core.Entity
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
JobExecution, JobInstance, StepExecution

public class Entity extends Object implements Serializable
Batch Domain Entity class. Any class that should be uniquely identifiable from another should subclass from Entity. See Domain Driven Design, by Eric Evans, for more information on this pattern and the difference between Entities and Value Objects.
Author:
Lucas Ward, Dave Syer, Mahmoud Ben Hassine
See Also:
  • Constructor Details

    • Entity

      public Entity(long id)
      The constructor for the Entity where the ID is established.
      Parameters:
      id - The ID for the entity.
  • Method Details

    • getId

      public long getId()
      Returns:
      The ID associated with the Entity.
    • getVersion

      public @Nullable Integer getVersion()
      Returns:
      the version.
    • setVersion

      public void setVersion(Integer version)
      Public setter for the version. Needed only by repository methods.
      Parameters:
      version - The version to set.
    • incrementVersion

      public void incrementVersion()
      Increment the version number.
    • toString

      public String toString()
      Creates a string representation of the Entity, including the id, version, and class name.
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object