Hi Slick users,
I've upgraded my code to slick 2.0.0 and now I get this exception:
scala.slick.SlickException: Cannot use node Select id for inserting data
id is defined as:
def id = column[Long] ("id", O.PrimaryKey, O.AutoInc)
The insert method I wrote looks like:
def insert(row: Row)(implicit session: Session): Unit = {
baseTableRow.all.shaped.insert(
, row.a
, row.b
, row.c
, row.d
, row.e
, row.f
, row.g
, row.h
, ( row.i.gross, row.i.tax )
, ( row.j.gross, row.j.tax )
, ( row.k.gross, row.k.tax )
, ( row.l.gross, row.l.tax )
, ( row.m.gross, row.m.tax )
, ( row.n.gross, row.n.tax )
, ( row.o.gross, row.o.tax )
, ( row.p.gross, row.p.tax )
, ( row.q.gross, row.q.tax )
, ( row.r.gross, row.r.tax )))
}
This was a work around that used nested case classes to work around 22 tuple limitations (which worked for slick 1.0.0). Not sure if that is relevant.
Am I missing something?
Cheers,
-John
scala.slick.SlickException: Cannot use node Select id for inserting data
at scala.slick.compiler.InsertCompiler$$anonfun$apply$1.scala$slick$compiler$InsertCompiler$class$$anonfun$$tr$1(InsertCompiler.scala:48)
at scala.slick.compiler.InsertCompiler$$anonfun$apply$1$$anonfun$scala$slick$compiler$InsertCompiler$class$$anonfun$$tr$1$2.apply(InsertCompiler.scala:35)
at scala.slick.compiler.InsertCompiler$$anonfun$apply$1$$anonfun$scala$slick$compiler$InsertCompiler$class$$anonfun$$tr$1$2.apply(InsertCompiler.scala:35)
at scala.slick.ast.Util$$anonfun$mapOrNone$1.apply(Util.scala:15)
at scala.slick.ast.Util$$anonfun$mapOrNone$1.apply(Util.scala:14)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
at scala.slick.ast.Util$.mapOrNone(Util.scala:14)
at scala.slick.ast.Node$class.nodeMapChildren(Node.scala:42)
at scala.slick.ast.ProductNode$$anon$2.nodeMapChildren(Node.scala:151)
at scala.slick.compiler.InsertCompiler$$anonfun$apply$1.scala$slick$compiler$InsertCompiler$class$$anonfun$$tr$1(InsertCompiler.scala:35)
at scala.slick.compiler.InsertCompiler$$anonfun$apply$1.apply(InsertCompiler.scala:50)
at scala.slick.compiler.InsertCompiler$$anonfun$apply$1.apply(InsertCompiler.scala:17)
at scala.slick.compiler.CompilerState.map(QueryCompiler.scala:144)
at scala.slick.compiler.InsertCompiler$class.apply(InsertCompiler.scala:17)
at scala.slick.jdbc.JdbcMappingCompilerComponent$JdbcInsertCompiler.apply(JdbcMappingCompilerComponent.scala:49)
at scala.slick.compiler.QueryCompiler$$anonfun$runPhase$1.apply(QueryCompiler.scala:55)
at scala.slick.compiler.QueryCompiler$$anonfun$runPhase$1.apply(QueryCompiler.scala:54)
at scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
at scala.slick.ast.SymbolNamer.use(Symbol.scala:101)
at scala.slick.compiler.QueryCompiler.runPhase(QueryCompiler.scala:54)
at scala.slick.compiler.QueryCompiler$$anonfun$run$2.apply(QueryCompiler.scala:46)
at scala.slick.compiler.QueryCompiler$$anonfun$run$2.apply(QueryCompiler.scala:46)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:144)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:144)
at scala.collection.Iterator$class.foreach(Iterator.scala:727)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:144)
at scala.collection.AbstractTraversable.foldLeft(Traversable.scala:105)
at scala.slick.compiler.QueryCompiler.run(QueryCompiler.scala:46)
at scala.slick.compiler.QueryCompiler.run(QueryCompiler.scala:41)
at scala.slick.profile.BasicProfile$Implicits$class.shapedValueToInsertInvoker(BasicProfile.scala:52)
at scala.slick.driver.JdbcProfile$$anon$1.shapedValueToInsertInvoker(JdbcProfile.scala:25)
at com.lib.taximate.slick.table.JobFares$.insert(JobFares.scala:137)
at com.lib.taximate.slick.impl.JobFareModuleImpl$$anonfun$insertFare$1.apply(JobFareModuleImpl.scala:18)
at com.lib.taximate.slick.impl.JobFareModuleImpl$$anonfun$insertFare$1.apply(JobFareModuleImpl.scala:18)
at scala.slick.backend.DatabaseComponent$DatabaseDef$class.withSession(DatabaseComponent.scala:31)
at scala.slick.jdbc.JdbcBackend$DatabaseFactoryDef$$anon$3.withSession(JdbcBackend.scala:46)
at com.lib.taximate.db.TaximateSlickDbModule$$anonfun$inTaximateSlick$1.apply(TaximateSlickDbModule.scala:15)
at com.lib.taximate.db.TaximateSlickDbModule$$anonfun$inTaximateSlick$1.apply(TaximateSlickDbModule.scala:15)
at scalaz.KleisliFunctions$$anon$17.run(Kleisli.scala:160)
at com.go.base.db.RunDbModuleImpl$class.unsafeTransaction(RunDbModuleImpl.scala:4)
at com.gocatch.gcs2.Main$.com$gocatch$gcs2$db$SquerylRunDbModuleOverlay$$super$unsafeTransaction(Main.scala:80)
at com.gocatch.gcs2.db.SquerylRunDbModuleOverlay$$anonfun$unsafeTransaction$1.apply(SquerylRunDbModuleOverlay.scala:11)
at com.gocatch.gcs2.db.SquerylRunDbModuleOverlay$$anonfun$unsafeTransaction$1.apply(SquerylRunDbModuleOverlay.scala:11)
at org.squeryl.dsl.QueryDsl$class._using(QueryDsl.scala:46)
at org.squeryl.dsl.QueryDsl$class._executeTransactionWithin(QueryDsl.scala:115)
at org.squeryl.dsl.QueryDsl$class.transaction(QueryDsl.scala:69)
at org.squeryl.PrimitiveTypeMode$.transaction(PrimitiveTypeMode.scala:40)
at com.gocatch.gcs2.db.SquerylRunDbModuleOverlay$class.unsafeTransaction(SquerylRunDbModuleOverlay.scala:11)
at com.gocatch.gcs2.Main$.unsafeTransaction(Main.scala:80)
at com.gocatch.gcs2.unsafe.RunDbModuleProxy$class.unsafeTransaction(RunDbModuleProxy.scala:11)
at com.gocatch.gcs2.job.Hail$.unsafeTransaction(Hail.scala:864)
at com.gocatch.gcs2.job.Hail$$anonfun$serializeToNewJob$1.apply$mcJ$sp(Hail.scala:1081)
at com.gocatch.gcs2.job.Hail$$anonfun$serializeToNewJob$1.apply(Hail.scala:1041)
at com.gocatch.gcs2.job.Hail$$anonfun$serializeToNewJob$1.apply(Hail.scala:1041)
at org.squeryl.dsl.QueryDsl$class._using(QueryDsl.scala:46)
at org.squeryl.dsl.QueryDsl$class._executeTransactionWithin(QueryDsl.scala:115)
at org.squeryl.dsl.QueryDsl$class.transaction(QueryDsl.scala:78)
at org.squeryl.PrimitiveTypeMode$.transaction(PrimitiveTypeMode.scala:40)
at com.gocatch.gcs2.job.Hail$.serializeToNewJob(Hail.scala:1041)
at com.gocatch.gcs2.actors.JobWorker$$anonfun$receive$1.applyOrElse(JobWorker.scala:116)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425)
at akka.actor.ActorCell.invoke(ActorCell.scala:386)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230)
at akka.dispatch.Mailbox.run(Mailbox.scala:212)
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:502)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)