in play 2.5, I am using the slick codegenerator from com.typesafe.slick "com.typesafe.slick" %% "slick-codegen" % "3.1.1" % "compile"
and it works fine: the auto-generated Slick data model is generated to the file target/scala-2.11/src_managed/slick/dao/Tables.scala
.
My question: how can I access the generated Models and TableQuery objects from a Controller, let's say app/controllers/myDAOController.scala
? Any hints or a working example would be highly appreciated. Thank you!
Just add
in your Controller. You will be able to use all your models.
Example: Here is your table:
You will access the generated Companies model like this:
See a complete example here : https://github.com/slick/slick-codegen-example/blob/master/src/main/scala/Example.scala