Class DurationToIntegerConverter
java.lang.Object
com.endurancetrio.data.event.model.converter.DurationToIntegerConverter
public class DurationToIntegerConverter
extends Object
implements jakarta.persistence.AttributeConverter<Duration,Integer>
The
DurationToIntegerConverter class is responsible for converting Duration
values to their corresponding database column representation (milliseconds) and vice versa.
This converter is used to persist Duration fields as an Integer of milliseconds
in the database. It converts the Duration to its total milliseconds when storing it and
converts the milliseconds back to a Duration when retrieving it from the database.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertToDatabaseColumn(Duration duration) convertToEntityAttribute(Integer milliseconds)
-
Constructor Details
-
DurationToIntegerConverter
public DurationToIntegerConverter()
-
-
Method Details