我爲我的日期/時間對象使用Joda庫和jadira userType項目通過Hibernate在我的MySQL數據庫中保存這些東西。Jadira UserType library JavaTimeZoneWorkaroundHelper
當運行應用程序,我得到
4 mars 2013 18:48:18 org.jadira.usertype.spi.reflectionutils.JavaTimeZoneWorkaroundHelper <clinit>
ATTENTION: Under JDK 6 it may not be possible to handle DST transitions correctly
4 mars 2013 18:48:18 org.jadira.usertype.spi.reflectionutils.JavaTimeZoneWorkaroundHelper <clinit>
GRAVE: Running under a Zone that uses daylight saving time. To avoid incorrect datetimes being stored during DST transition, either update to JDK 7 or use a Timezone for the JDK without Daylight Saving Time
因此,從文本我有兩個選擇: - 安裝JDK 7,我不想做(我在Mac OS 10.6。 8,我也不想使用「太近」的java版本) - 使用沒有DST的時區。這意味着我必須將我的JVM的默認TimeZone設置爲像俄羅斯或南美某個位置的位置。
我可以簡單地禁用Jadira的
JavaTimeZoneWorkaroundHelper
功能嗎?怎麼樣 ?我想到另一種選擇:不要使用jadira提供的東西(將joda對象轉換爲字符串以及將字符串轉換爲joda對象)並自己完成轉換。
你有什麼建議? 謝謝
這不起作用。我使用-Duser.timezone =「GMT」設置了JVM參數,而不是 – facewindu 2013-03-04 21:17:56
GMT和UTC實際上是相同的,至少對於除科學計時以外的所有其他參數都足夠接近。請參閱Wikipedia條目:http://en.wikipedia.org/wiki/Coordinated_Universal_Time – RedYeti 2013-08-14 11:39:27