2
我不知道什麼squeryl正試圖在這裏告訴我:Squeryl部分更新不編譯
錯誤:不能證明org.squeryl.dsl.fsm.Unconditioned =:= org.squeryl.dsl .fsm.Conditioned。
在:
inTransaction {
update(AppDB.postTable) { p =>
where(p.id === postId)
set(p.upVotes := p.upVotes.~ + 1)
}
的錯誤是在set子句
模式:
object AppDB extends Schema {
val postTable = table[Post]("post")
val replyTable = table[Reply]("reply")
val postToReplies = oneToManyRelation(postTable, replyTable)
.via((p,r) => p.id === r.postId)
}
case class Post(body: String, image:Option[String]) extends KeyedEntity[Long] {
val id: Long = 0
val posted: Date = new Date()
var upVotes: Long = 0
var downVotes: Long = 0
}
case class Reply(postId: Long, body: String, image:Option[String]) extends KeyedEntity[Long] {
val id: Long = 0
val posted: Date = new Date()
}
感謝您的幫助。
做了詭計,我很想知道原因,但: –
也適用於我的情況。 stll無法弄清楚爲什麼 – alboko