0
votes

I have a table with no primary keys. How can I insert data into it. When I have a table with primary key I can do insertOrUpdate(...) but I don't see a method for just inserting.

This is what I do for tables with primary keys:

db.run(table.insertOrUpdate(colorEntity))
1

1 Answers

0
votes

You can resort to using += to insert a row:

db.run(table += colorEntity)

To insert multiple rows in a batch, use ++=:

val colorEntities: Seq[Color] = Seq(...)
db.run(table ++= colorEntities)