Joda-Time Hibernate PersistentYearMonthDay已弃用 [英] Joda-Time Hibernate PersistentYearMonthDay Deprecated

查看:156
本文介绍了Joda-Time Hibernate PersistentYearMonthDay已弃用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在浏览Joda-Time Hibernate 用户指南时,会出现没有对SQL DATE类型的未来支持。由于TIMESTAMP被指定在1970年1月1日开始 - 1970年之前日期的唯一安全传输似乎是VARCHAR和PersistentLocalTimeAsString(如果希望将自己限制在Joda Hibernate库)。



作为使用DATE的人(并且看到Joda Hibernate不是),我想知道是否有某些原因需要切换到VARCHAR和PersistentLocalTimeAsString。 IE浏览器。什么动机决定弃用PersistentYearMonthDay?

解决方案

它不是1970年开始的,它是一个零点,但它可能是负。不推荐使用 PersistentYearMonthDay 的原因是不推荐使用 YearMonthDay 。动机为使用LocalDate,它具有更好的内部实现,并且从1.3开始可用



另外,它很奇怪,但源代码为PersistentLocalDate有 DATE sql类型,而用户指南说 TIMESTAMP ,尝试它,也许只是一个错字用户指南。

In looking through the Joda-Time Hibernate user guide it appears that there is no future support for the SQL DATE type. Since TIMESTAMP is specified to start on Jan 1, 1970 - the only safe transport for dates before 1970 appears to be VARCHAR with PersistentLocalTimeAsString (if one wishes to restrict themselves to the Joda Hibernate library).

As someone who uses DATE (and seeing that Joda Hibernate isn't) I am wondering if there is some reason I should switch to VARCHAR and PersistentLocalTimeAsString. Ie. what motivated the decision to deprecate PersistentYearMonthDay?

解决方案

It doesn't start on 1970, it's a zero point, but it could be negative. The reason why the PersistentYearMonthDay deprecated is deprecation of YearMonthDay. Motivated as "Use LocalDate which has a much better internal implementation and has been available since 1.3"

Also, it's weird, but the source code for the PersistentLocalDate has DATE sql type, while the user guide says TIMESTAMP, try it, maybe just a typo in the user guide.

这篇关于Joda-Time Hibernate PersistentYearMonthDay已弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆