'wrong top statement declaration' when using slick in IntelliJ
Asked Answered
E

1

8

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?

Edging answered 27/5, 2016 at 11:19 Comment(0)
E
3

According to this I changed

val robs = TableQuery[Robs]

to

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

No warnings or errors anymore. :)

Edging answered 27/5, 2016 at 11:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.