Search code examples
slickscalaquery

Trying to do first steps with SLICK but things do not seem to work or documentation is outdated


A custom source code generator was used in order to create the classes necessary for the MySQL database as described in this question: How to setup username and password with Slick's source code generator?

Then tried to follow the getting started guide in order to execute the most simple queries using SLICK and try out its capabilities.

The TableQuery vals created from source code generator do not have the attribute ddl in order to execute something like that: suppliers.ddl

Also I tried to create my own having a code like that: val models = TableQuery[Model]

So I tried this: models += ModelRow(...) but this is not working because compiler complains that model is not a string and also that a re-assignment to a val is being performed.

In addition the models.foreach(....) method does not exist.

I have started on the wrong foot here. Some help is required to get on the right track. Thank you


Solution

  • Finally I figured out what needed to be done by combining several posts found in the internet

    For busy developers there is a guide explaining the entire solution and how to integrate slick into play framework in a fast in this blog post: http://pligor.tumblr.com/post/75933978759/integrate-slick-2-0-into-play-the-easy-and-fast-way

    Enjoy!

    PS: Thanks @Martin Kolinek for the help