Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'wrong top statement declaration' when using slick in IntelliJ

I'm currently porting a project from scala 2.9 to 2.10, therefore I have to use slick instead of scalaquery. I'm using slick 2.1.0 for now since it supports MS Access.

According to this tutorial and the upgrade guide I changed Robs from object to class and added the val robs:

Error defining val robs

Why do I get the error message Wrong top statement declaration and how do I get rid of it?

EDIT: I'm new to scala... According to this question it seems like I can't put a val outside of methods or classes, right? The code above is directly in a packge. But what is the right approach for slick then? Should I move the code in some class or trait?

like image 348
SimonH Avatar asked May 27 '16 11:05

SimonH


1 Answers

According to this I changed

val robs = TableQuery[Robs]

to

object robs extends TableQuery(new Robs(_)) {}.

No warnings or errors anymore. :)

like image 81
SimonH Avatar answered Nov 12 '22 01:11

SimonH