gpt4 book ai didi

mysql - Play-Slick 插件,在 DateTime 变量、数据类型的情况下抛出抽象错误

转载 作者:行者123 更新时间:2023-11-29 23:38:29 24 4
gpt4 key购买 nike

我一直使用 slick 2 作为我的 play 应用程序的 dbms,尽管使用 play-slick 插件而不是独立的 slick,并且还添加了 tototoshi 插件,依赖项是:

"joda-time" % "joda-time" % "2.4"
"org.joda" % "joda-convert" % "1.6"
"com.github.tototoshi" %% "slick-joda-mapper" % "1.2.0"
"com.typesafe.play" %% "play-slick" % "0.6.1"
"com.typesafe.slick" %% "slick" % "2.0.3"

案例类别和投影是:

//使用光滑的导入

import play.api.db.slick.Config.driver.simple._
import play.api.db.slick.DB
import scala.slick.lifted.ProvenShape
import com.github.tototoshi.slick.MySQLJodaSupport._

case class Design(
var id: Int,
var imageName: String,
var title: String,
var creatorID: Int,
var flagged: Boolean,
var modifiedTimestamp: Instant,
var createdTimestamp: Instant) {
def this() = this(0, "", "", 0, false, DateTime.now.toInstant, DateTime.now.toInstant)
}

class DesignProjection(tag: Tag) extends Table[Design](tag, "designs_47") {
def id: Column[Int] = column[Int]("id", O.PrimaryKey, O.AutoInc)
def imageName: Column[String] = column[String]("des_image_name")
def title: Column[String] = column[String]("des_title")
def creatorID: Column[Int] = column[Int]("des_creator_id")
def flagged: Column[Boolean] = column[Boolean]("des_flagged_link")
def modifiedTimestamp: Column[Instant] = column[Instant]("tt_modified_timestamp")
def createdTimestamp: Column[Instant] = column[Instant]("tt_tweeted_timestamp")

def * : ProvenShape[Design] = (id, imageName, title, creatorID, flagged, modifiedTimestamp, createdTimestamp) <> (
((Design.apply _): (Int, String, String, Int, Boolean, Instant, Instant) => Design).tupled,
Design.unapply)

}

当我尝试使用方法列出所有行时:

def list: List[Design] = {
println("Start Listing")
val result = DB.withSession { implicit session =>
val res = designProjection.list <-error here
res
}
convertListResultSet(result)
}

我得到[RuntimeException: java.lang.AbstractMethodError],我更加确定它是 DataTime 类的原因,但我真的不知道出了什么问题。我也使用过 tototoshi 插件。考虑 DateTime 的所有其他情况,它们都工作正常。

非常欢迎任何帮助或指示。谢谢

最佳答案

这是一个已知问题。 https://github.com/tototoshi/slick-joda-mapper/issues/19

你能尝试一下 slick-joda-mapper 1.1.0 吗?

关于mysql - Play-Slick 插件,在 DateTime 变量、数据类型的情况下抛出抽象错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26298856/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com