If you are still using JPA 2.0 or lower, or Java SE 7 or lower: - map dates and times as Strings in the format "YYYY-MM-DD" (for dates), "HH:MM:SS.mmm" (for time of day) or "YYYY-MM-DD HH:MM:SS.mmm" (for date and time). This way the alphabetical order and temporal order are equivalent. If you need the date as a complex structures such as a GregorianCalendar, then add @Transient getters and setters (do NOT map as GregorianCalendar!) - map absolute moments in time as java.util.Date with TemporalType.TIMESTAMP - do NOT use equals() to check equality of Dates retrieved from the persistence store, but instead, use compareTo() Otherwise, you will get into a world of hurt.
@tacosdecamaron4 жыл бұрын
Thank you Thorben, I have been battling JPA in Spring boot for a project these days. Your videos have been helpful. Regards.