Class Course
java.lang.Object
com.endurancetrio.data.common.model.entity.AuditableEntity
com.endurancetrio.data.common.model.entity.BaseEntity<Long>
com.endurancetrio.data.event.model.entity.Course
- All Implemented Interfaces:
Serializable
The
Course entity represents a course
used by an Event's Race.
The Course's fields are defined as follows:
-
id: the unique identifier of theCoursethat is automatically generated and is the primary key. -
event: theEventto which theCoursebelongs. -
title: the title of theCourse, typically consisting of the name of theCourse'ssportand its distance, such as "Sprint Triathlon" or "Standard Duathlon". When anEventhas differentcourseswith the same distance (e.g. with different routes), a second reference should be added to the title of theCourseso that they can be unambiguously differentiated. -
sport: theSportof theRacethat theCourseis used for. -
distance: the data of aCourse'sDistance. EachCoursehas a uniqueDistance, and distances are not shared across multiple courses. The relationship is unidirectional, meaningDistancedoes not have a reference back toCourse. Deleting aCoursewill also delete its associatedDistancedue to cascading and orphan removal settings. -
races: theracesthat theCourseis used for.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanEquality is based on the entity's identifier.getEvent()getRaces()getSport()getTitle()inthashCode()voidremoveRace(Race race) voidsetDistance(Distance distance) voidvoidvoidvoidtoString()Methods inherited from class com.endurancetrio.data.common.model.entity.BaseEntity
getId, setIdMethods inherited from class com.endurancetrio.data.common.model.entity.AuditableEntity
getCreatedAt, getUpdatedAt, getVersion
-
Constructor Details
-
Course
public Course()Default constructor for theCourseentity.
-
-
Method Details
-
addRace
Adds aRaceto thisCourse'sracescollection. Ensures bidirectional consistency by also adding thisCourseto theRace'scoursescollection.- Parameters:
race- theRaceto add; ignored ifnullor already present
-
removeRace
Removes aRacefrom thisCourse'sracescollection. Ensures bidirectional consistency by also removing thisCoursefrom theRace'scoursescollection.- Parameters:
race- theRaceto remove; ignored ifnullor not present
-
getEvent
-
setEvent
-
getTitle
-
setTitle
-
getSport
-
setSport
-
getDistance
-
setDistance
-
getRaces
-
setRaces
-
equals
Description copied from class:BaseEntityEquality 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:
equalsin classBaseEntity<Long>
-
hashCode
public int hashCode()- Overrides:
hashCodein classBaseEntity<Long>
-
toString
-