Class BaseEntity<T extends Serializable>

java.lang.Object
com.endurancetrio.data.common.model.entity.AuditableEntity
com.endurancetrio.data.common.model.entity.BaseEntity<T>
Type Parameters:
T - the type of the identifier, which must be serializable
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AgeGroup, Athlete, Course, DeviceTelemetry, Distance, Event, EventFile, IndividualResult, Organizer, ParaClass, Race, ResultsFile, Route, RouteSegment, Team, TeamResult

@MappedSuperclass public abstract class BaseEntity<T extends Serializable> extends AuditableEntity
BaseEntity is an abstract class that serves as a base for all entities in the system. It provides a generic identifier field and common equality and hashing methods.
See Also:
  • Constructor Details

    • BaseEntity

      public BaseEntity()
  • Method Details

    • getId

      public T getId()
    • setId

      public void setId(T id)
    • equals

      public boolean equals(Object o)
      Equality is based on the entity's identifier. Two entities are considered equal if they are of the same class and have the same non-null identifier.

      If the ID is null, we treat it as a transient (new) object. Transient objects are only equal if they are the exact same instance.

      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object