1

I use slick and playframework 2.1 why "~" is not recognize as operator, why?

object Comments extends IdTable[CommentId, Comment]("COMMENTS") {

def text = column[String]("TEXT")

// you can use your type-safe ID here - it will be mapped to long in database
def authorId = column[UserId]("AUTHOR")

def author = foreignKey("COMMENTS_AUTHOR_FK", authorId, Users)(_.id)

def date = column[DateTime]("DATE")

def base = text ~ authorId ~ date

override def * = id.? ~: base <> (Comment.apply _, Comment.unapply _) //the error happens here.

override def insertOne(elem: Comment)(implicit session: Session): CommentId =
saveBase(base, Comment.unapply _)(elem)

}

the error is:

[error] C:\assigment\slick-advanced\app\models\Comment.scala:30: value ~: is not
a member of scala.slick.lifted.Projection3[String,models.UserId,org.joda.time.DateTime]

why the ~ operator can not apply?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user504909
  • 9,119
  • 12
  • 60
  • 109
  • What is your `slick` version? It seems that `~:` [appears](https://github.com/slick/slick/commit/9ebbca79234ea1998d35fdc6e3cde858b2ac0cb1) in `1.0.0` – senia Dec 27 '13 at 05:45

1 Answers1

0

The operator it complains about is ~:, not ~. The error is probably just a consequence of the DateTime error. Slick does not support joda time out of the box. This should help: https://github.com/tototoshi/slick-joda-mapper

cvogt
  • 11,260
  • 30
  • 46