How to map Duration type with JPA

前端 未结 3 979
耶瑟儿~
耶瑟儿~ 2021-01-06 04:12

I have a property field in a class that is of type javax.xml.datatype.Duration. It basically represents a time span (e.g. 4 hours and 34 minutes).

JPA

3条回答
  •  旧时难觅i
    2021-01-06 04:54

    You could try joda-time hibernate. Refer to the available types that can be persisted. You could then use the joda Duration in the following way:

    @Type(type="org.joda.time.contrib.hibernate.PersistentDuration")
    private Duration startDateTime;
    

提交回复
热议问题