Can't import from slick.driver.H2Driver.simple._ in Scala

447 views Asked by At

I'm trying to use Slick in Scala, I've followed the docs and the examples, installed the sbt dependencies and I have this problem:

api-scala\src\main\scala\com\example\app\MyScalatraServlet.scala:7: value simple is not a member of object slick.driver.H2Driver [error] import slick.driver.H2Driver.simple._

I've tried with import scala.slick.driver.H2Driver.simple._ too, and can't find the solution to this.

I'm using IntelliJ IDEA as IDE.

This is my code in MyScalatraServlet.scala:

package com.example.app
import com.example.app.models._
import org.scalatra._
import org.scalatra.scalate.ScalateSupport
import org.json4s.{DefaultFormats, Formats}
import org.scalatra.json._
import slick.driver.H2Driver.simple._
import slick.jdbc.JdbcBackend.Database.dynamicSession

class MyScalatraServlet(db: Database) extends ApiscalaStack with ScalateSupport with JacksonJsonSupport {
  protected implicit lazy val jsonFormats: Formats = DefaultFormats

  before() {
    contentType = formats("json")
  }
  get("/") {
    contentType="text/html"
    layoutTemplate("/WEB-INF/templates/views/index.mustache")
  }
  get("/about/?") {
    <p>About</p>
  }
  get("/flor/?") {
    FlowerData.all
  }
  get("/user/:name?") {
    <p>User: {params("name")}</p>
  }
}

Any ideas?

Thanks!

1

There are 1 answers

0
nmat On

Which slick version are you using? For slick 3 it's

import scala.slick.driver.H2Driver.api._