java.time YearMonth as a type within entity

假如想象 提交于 2019-12-06 07:17:19

If your JPA provider does not persist a type in a sensible manner (in this case because it is a Java8 class, which was added after JPA 2.1 was approved, and because you're using EclipseLink which hasn't had much updates of late to support newer types) then you need to define a JPA 2.1 AttributeConverter to convert it to a standard JPA persistable type (in this case something like java.sql.Date).

Other JPA providers support persisting such types out of the box (DataNucleus JPA certainly does, and Hibernate also maybe with an optional dependency?)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!