O'Reilly logo

Play Framework Cookbook - Second Edition by Giancarlo Inductivo, Alexander Reelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Integrating with Play application Typesafe Slick

In this recipe, we will explore how we can integrate Typesafe Slick with Play applications using the play-slick module. Typesafe Slick is a relational mapping tool built on Scala and is handy for managing database objects like native Scala types.

How to do it…

We need to take the following steps:

  1. Run the foo_scala application with Hot-Reloading enabled:
        activator "~run"
    
  2. Declare play-slick as a project dependency in build.sbt:
        "com.typesafe.play" %% "play-slick" % "0.8.1"
  3. Specify your database host information in foo_scala/conf/application.conf:
        db.default.driver=org.h2.Driver
        db.default.url="jdbc:h2:mem:play"
        db.default.user=sa
        db.default.password=""
        slick.default="models.*"
  4. Create the new supplier ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required