Slick Create Table

484 Views Asked by At

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

0

There are 0 best solutions below