Is it possible to use a foreign key field in a Slick where
or filter
statement?
Something like (where the user
field is a foreign key to a Table for which User
is its mapped projection) (this does not compile):
def findByUser(user: User)(implicit s: Session): Option[Token] =
tokens.where(_.user === user).firstOption
Or should we use the foreign key explicitely?
def findByUser(user: User)(implicit s: Session): Option[Token] =
tokens.where(_.userId === user.id).firstOption