Java Joda日期时间格式为yyyy MM DD HH:MM:SS

Java Joda日期时间格式为yyyy MM DD HH:MM:SS,java,datetime,jodatime,Java,Datetime,Jodatime,这是我使用Joda DateTime获得的日期时间格式2019-01-10T13:59:36.700+05:30 claimGroupingHistory.setCreatedAt(new DateTime()); 但我在插入数据库时遇到以下错误 2019-01-10 13:59:36,754 [http-9292-1] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper: 146 - Data truncation: Incor

这是我使用Joda DateTime获得的日期时间格式
2019-01-10T13:59:36.700+05:30

 claimGroupingHistory.setCreatedAt(new DateTime());
但我在插入数据库时遇到以下错误

2019-01-10 13:59:36,754 [http-9292-1] ERROR   org.hibernate.engine.jdbc.spi.SqlExceptionHelper: 146 - Data truncation: Incorrect datetime value: '\xAC\xED\x00\x05sr\x00\x16org.joda.time.DateTime\xB8<xdj[\xDD\xF9\x02\x00\x00xr\x00\x1Forg.joda.time.base.BaseDateTime\xFF\xFF\x' for column 'created_at' at row 1

2019-01-10 13:59:36754[http-9292-1]ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper:146-数据截断:不正确的日期时间值:'\xAC\xED\x00\x05sr\x00\x16org.joda.time.datetime\xB8您可能应该在hibernate 3中使用:

@Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")
在场上

对于Hibernate版本4-5,添加以下内容:

@Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")


您可能应该在Hibernate 3中使用:

@Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")
在场上

对于Hibernate版本4-5,添加以下内容:

@Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")


也许这有帮助:你不应该这样做。您应该将标准日期/时间中的“值”存储到数据库中,并让驱动程序处理转换可能会有所帮助:您不应该这样做。您应该将标准日期/时间中的“值”存储到数据库中,并让驱动程序处理转换