How to prepare data for bulk insert in scala slick 2.1.0

73 views Asked by At

I'm using Slick 2.1.0. I'm trying to perform insertAll from a case class.

The structure of case class is

case class ClassA(field1: Int, field2: ClassB)
case class ClassB(field3: String, field4: String)

There's a function def bulkInsert(param: List[ClassA]) I tried this approach approach.

val data = param.map( p => (p.field1, p.classB.field3, p.classB.field4))

dbTable.map(e => (e.field1, e.field2, e.field3))
.insertAll(data)

But I'm getting error

Required: Tuple
Found: List

What shall be done to fix this issue

0

There are 0 answers