scala - why the "===" operation do not work on "filter" or "where" do not apply on my TableQuery [slick2] -
i use slick 2.0.2 , scala, datamodel is:
case class aditem(id:option[long], res:string,status:string,userid:string, head:string,summary:string, url:string, position:string) class advertisement(tag:tag) extends table[aditem](tag, "advertisement"){ def id=column[long]("id", o.primarykey, o.autoinc) def res=column[string]("resource") def status=column[string]("status") def userid=column[string]("user") def head=column[string]("head") def summary=column[string]("summary") def url=column[string]("ad_link") def position=column[string]("position") def * = (id.?, res, status, userid, head, summary, url, position)<>(aditem.tupled, aditem.unapply) def userfk=foreignkey("ad_use_fk", userid, userdata)(_.id) }
this tablequery:
val addata=tablequery[advertisement]
when execute the:
val idd="1232232" addata.filter(_.id === idd.tolong)
i error is:
[error] g:\testprojects\slickplay\app\controllers\adcontroller.scala:30: value = == not member of scala.slick.lifted.column[long] [error] addata.filter(_.id === idd.tolong)
i follow instruction of http://slick.typesafe.com/doc/2.0.2/queries.html#sorting-and-filtering
i think "===" can apply column[long]
you have import proper implicit conversions:
import scala.slick.driver.jdbcdriver.simple._
or
import scala.slick.driver.thedriverofmychoice.simple._
Comments
Post a Comment