How to persist LocalDate with JPA?

后端 未结 5 731
栀梦
栀梦 2020-12-04 01:22

I want to store Date without time into my database. So, I choose to use LocalDate type.

As mentioned in this article, I use a JPA converter to convert

5条回答
  •  鱼传尺愫
    2020-12-04 01:59

    Hibernate 5 supports java 8, so you can add this to your pom.xml:

    
        org.hibernate
        hibernate-java8
        5.1.0.Final
    
    

    This gives you mapping for LocalDate and LocalDateTime out of box.

提交回复
热议问题