O'Reilly logo

Scala for Java Developers by Thomas Alexandre

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

Learning about Slick

Let's explore the behavior of the Slick framework through code examples to see how we can enhance and replace more traditional ORM solutions.

The first example we can study is part of the test-patterns-scala activator template project that we have analyzed in Chapter 4, Testing Tools. The scalatest/Test012.scala file found inside the project exhibits a typical usage of Slick as follows:

package scalatest import org.scalatest._ import scala.slick.driver.H2Driver.simple._ import Database.threadLocalSession object Contacts extends Table[(Long, String)]("CONTACTS") { def id = column[Long]("CONTACT_ID", O.PrimaryKey) def name = column[String]("CONTACT_NAME") def gender = column[String]("GENDER") def * = id ~ name } class Test12 extends ...

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