I do not understand what is wrong with my filter (inferred type arguments [Boolean] do not conform..

1,986 views
Skip to first unread message

Miuler

unread,
Jun 9, 2014, 2:14:20 PM6/9/14
to scala...@googlegroups.com
Hi, I do not understand what is wrong


Code
...
    class Edifile(_tableTag: Tag) extends Table[EdifileRow](_tableTag, "edifile") {
    ...
    }
...
    lazy val Edifile = new TableQuery(tag => new Edifile(tag))

    db.withSession { implicit session =>
      val edifile = Edifile.filter(_.id == edifileId)
      println(edifile)
    }
...


Error
Error:(22, 29) inferred type arguments [Boolean] do not conform to method filter's type parameter bounds [T <: scala.slick.lifted.Column[_]]
      val edifile = Edifile.filter(_.id == edifileId)
                            ^
Error:(22, 41) type mismatch;
 found   : com.nextstar.b2b.entity.Tables.Edifile => Boolean
 required: com.nextstar.b2b.entity.Tables.Edifile => T
      val edifile = Edifile.filter(_.id == edifileId)
                                        ^
Error:(22, 35) Type T cannot be a query condition (only Boolean, Column[Boolean] and Column[Option[Boolean]] are allowed
      val edifile = Edifile.filter(_.id == edifileId)
                                  ^



What is the error? is not a simple filter with boolean?

Marius Muja

unread,
Jun 9, 2014, 3:31:14 PM6/9/14
to scala...@googlegroups.com
You need to use === instead of ==.


--

---
You received this message because you are subscribed to the Google Groups "Slick / ScalaQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalaquery+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalaquery/fd1ac3c0-fa02-40c9-86ba-3c5897a00206%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Miuler

unread,
Jun 9, 2014, 3:47:19 PM6/9/14
to scala...@googlegroups.com
:O thanks


but it gave me this error:
  value === is not a member of Tables.profile.simple.Column[Long]


but after searching I found I had to add this:
  import scala.slick.driver.MySQLDriver.simple._


all sorted

Thanks :D

Fayimora Femi-Balogun

unread,
Jul 3, 2014, 12:08:02 AM7/3/14
to scala...@googlegroups.com
I had this problem few days ago and fixed it with ===. Unfortunately, I have run into it again, in a slightly different way.

The code in question is: problems.filter(p => ids.contains(p.id)).list

All i'm trying to do is select rows given a list of ids.

Any idea how to fix this?

Cheers

Naftoli Gugenheim

unread,
Jul 3, 2014, 1:26:15 AM7/3/14
to scala...@googlegroups.com
I think the slick syntax is p.id inSet ids.
 


--

---
You received this message because you are subscribed to the Google Groups "Slick / ScalaQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalaquery+...@googlegroups.com.

Fayimora Femi-Balogun

unread,
Jul 3, 2014, 5:25:13 AM7/3/14
to scala...@googlegroups.com
Thanks!

-- 
---------------------
Fayimora Femi-Balogun
Computer Science Student
Sent with Sparrow

You received this message because you are subscribed to a topic in the Google Groups "Slick / ScalaQuery" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scalaquery/6SudvEouWRo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scalaquery+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalaquery/CANpg8PAJ%2BA5G%3DDnD03s3SAKSmv3VKvx%2BfiOnpMK8-3Eyiuk_Og%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages