我一直在为 usingexecuteUpdate()
和executeInsert()
.
在下面的代码中,我使用了executeInsert()
def addEntry(day: DateMidnight, create_time: DateTime, points: Long, src: String) = DB.withTransaction { implicit connection =>
Logger.debug("I got here")
SQL(
"""
INSERT INTO density_cache(day_of, create_time, points, src)
VALUES ({day_of}, {create_time}, {points}, {src})
"""
).on(
'day_of -> day,
'create_time -> create_time,
'points -> points,
'src -> src
).executeInsert()
Logger.debug("Got to 2nd step")
}
我遇到以下问题:Java.lang.RuntimeException: TypeDoesNotMatch(Cannot convert 2013-04-15 13:58:46.0:class java.sql.Timestamp to Long for column ColumnName(density_cache.day_of,Some(day_of)))
但是当我切换到 时executeUpdate()
,它工作正常。