JPA支持Java 8新的日期和时间API [英] JPA support for Java 8 new date and time API
问题描述
我正在使用Java 8作为我的新项目。
I'm using Java 8 for my new project.
我正在尝试在java 8中使用新的日期和时间api但是我不知道是否 JPA 2.1
是否完全支持这个新的日期和时间API。
I'm trying to use new date and time api in java 8 however I don't know if JPA 2.1
fully supports this new Date and Time API or not.
请分享您在JPA中的经验/意见■支持Java 8中的新日期和时间API。
Please share your experience/opinion in JPA`s supports for new date and time API in Java 8.
我可以使用JPA 2.1安全地在Java 8中使用新的日期和时间api吗?
更新:
我正在使用Hibernate(4.3.5.Final) )作为JPA实现。
I'm using Hibernate (4.3.5.Final) as JPA implementation.
推荐答案
JPA 2.1是一个在Java 1.8之前出现的规范,所以不要求任何支持它。显然,某些实现可能支持某些Java 1.8功能。有些人遇到Java 1.8字节码(例如EclipseLink)的问题。我知道DataNucleus支持java.time和Java 1.8,因为那是我使用的。您必须检查您的实现是否支持级别。
JPA 2.1 is a spec that came out before Java 1.8, so doesn't mandate any support for it. Obviously some implementations may support some Java 1.8 features. Some have problems with Java 1.8 bytecode (e.g EclipseLink). I know DataNucleus supports java.time and Java 1.8 since that's the one I use. You'd have to check your implementation for what its support level is.
已请求JPA 2.2支持java.time类型,请参阅此问题 https://java.net/jira/browse/JPA_SPEC-63
It has been requested that JPA 2.2 support the java.time types, see this issue https://java.net/jira/browse/JPA_SPEC-63
这篇关于JPA支持Java 8新的日期和时间API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!