Search code examples
hibernatejava-8hibernate-mappingjava-time

How to reference java.time.LocalDate in hbm file?


How to reference java.time.LocalDate type in a *hbm.xml file? I tried type="localdate" and it didn't work. Unfortunatelly it is not allowed to use annotations in this project to map entities.

The question How to persist LocalDate into Hibernate as a Date type does not answer my question because when I use type="date" hibernate maps it to java.util.Date instead.


Solution

  • From docs and if you are using 5.2 you should able to map using LocalDate or java.time.LocalDate

    <property name="date" column="tb_date" type="LocalDate" />