0
votes

I have a Play-based application using PostgreSQL and Slick. I established a connection with the database (I've successfully generated the schema automatically).

I try to insert a row in a table:

val userdb = TableQuery[Userprofiles]
val insertion = userdb += (1, "firstname", "lastname", "address");

I got two compiler errors:

reassignment to val

too many arguments for method

How I can solve the problem?

1

1 Answers

0
votes

You need to run the query with db.run which will return a scala.concurrent.Future like this: val future = db.run(userdb += (1, "firstname", "lastname", "address"))

db is available by extending HasDatabaseConfig as shown in the the Playframework docs.

A great resource for learning Slick DB is Essential Slick.