0

I use next code for create simple table as in tutorial:

 import scala.slick.driver.H2Driver.simple._
 import scala.slick._
 import scala.slick.lifted.{ProvenShape, TableQuery}

 object MyModels {

   case class Person(id: Option[Long], name: String)

   class Persons(tag: Tag) extends Table[Person](tag, "persons") {
     def id = column[Long]("id", O.PrimaryKey, O.AutoInc)
     def name = column[String]("name")

     def *  = (id.?, name) <> (Person.tupled, Person.unapply)
   }
   lazy val sources = TableQuery[Persons]
}

But when i try compile it i get:

[error] bad symbolic reference. A signature in package.class refers to type compileTimeOnly
[error] in package scala.annotation which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling package.class.
[error] /home/user/example/src/main/scala/example/mymodels/MyModels.scala:16: Reference to method anyToToShapedValue in trait Implicits should not have survived past type checking,
[error] it should have been processed and eliminated during expansion of an enclosing macro.    
[error]      def *  = (id.?, name) <> (Person.tupled, Person.unapply)
[error]               ^
[error] /home/user/example/src/main/scala/example/mymodels/MyModels.scala:16: Reference to method tupled in trait Function2 should not have survived past type checking,
[error] it should have been processed and eliminated during expansion of an enclosing macro.
[error]      def *  = (id.?, name) <> (Person.tupled, Person.unapply)
[error]                                       ^
[error] /home/user/example/src/main/scala/example/mymodels/MyModels.scala:16: Reference to method tuple2Shape in trait ShapeLowPriority2 should not have survived past type checking,
[error] it should have been processed and eliminated during expansion of an enclosing macro.
[error]      def *  = (id.?, name) <> (Person.tupled, Person.unapply)
[error]                            ^
[error] four errors found
[error] (compile:compile) Compilation failed

Why? And how to fix it?

Scala-2.10.4 and slick-2.1.0

lito
  • 989
  • 8
  • 21
  • works fine! you have a problem in your dependencies. Check build.sbt – mohit Nov 19 '14 at 12:33
  • Also note that there's a conceptual error in your code, `Person` shouldn't have an optional id since the column is mandatory (and thus will never be empty), not sure why you have that as option. – Ende Neu Nov 19 '14 at 12:42
  • @mohit what need for dependencies? I have the same as in slick examples. – lito Nov 19 '14 at 15:04
  • Please add your build.sbt in the question which will help in debugging. There are lots of questions regarding bad symbolic reference. You can try googling. – mohit Nov 19 '14 at 15:07

0 Answers0