We're migrating our Hibernate (5.0.2) code to Java 8, which also involves conversion from java.util.Date
to java.time.LocalDate
(to solve issues related to date handling in Java 7). One of the problems I've run into is how Hibernate handles a special value we're using as a "zero date", which is 0001-01-01
.
The property is declared as follows:
@NotNull
@Column(name = "START_DATE", nullable = false)
private LocalDate startDate;
The value is stored in the database as 0001-01-01
, however when it's loaded by Hibernate it suddenly turns to 0000-12-29
. I assume this happens because Hibernate uses Gregorian calendar by default, and since this date is before it was introduced, some conversion is used.
Is there any way to configure Hibernate to disable this behaviour (apart from implementing a special property writer)?
hibernate-validator
, whose latest version in the 5.0.x family was 5.0.3, and that one refuses to work with 5.0.6hibernate-core
. Any idea why the version is so far behind / when it'll be fixed? – Calzada