java.util.Date to java.sql.Date doesn't contain Time

前端 未结 4 791
梦毁少年i
梦毁少年i 2021-01-16 15:29

I\'m getting a SqlException on a PreparedStatement for violating a uniqueness constraint on a table (dupe key). Essentially my table looks like thi

4条回答
  •  [愿得一人]
    2021-01-16 16:30

    Instead of setDate you need to try setTimestamp

    java.sql.Date - A date only (no time part)
    java.sql.Time - A time only (no date part)
    java.sql.Timestamp - Both date and time
    

提交回复
热议问题