Search code examples
databaseplayframeworksbtebean

How config Ebean in Playframework 2.4


I am using Play version 2.4, but the logic is changed.

I tried to follow your tutorial, but without success.

application.conf

db.default.driver="org.postgresql.Driver"
db.default.url="jdbc:postgresql://localhost:5432/dabaseName"
db.default.user=postgres
db.default.password="postgres"
ebean.default = ["models.*"]

plugin.sbt

addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")

build.sbt

name := """XXXX"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean)

scalaVersion := "2.11.6"

libraryDependencies ++= Seq(
    javaJdbc,
    cache,
    javaWs
)

libraryDependencies += evolutions

libraryDependencies += "postgresql" % "postgresql" % "9.1-901.jdbc4"

routesGenerator := InjectedRoutesGenerator

output

Part of error


Solution

  • In the before version of play, the connection pool was provided by 'BoneCP', but in new version is provided by 'HikariCP'.

    There 2 ways:

    1 - Change connection pool

    Add the property: 'play.db.pool = bonecp'

    2 - Update your JDBC Driver
    libraryDependencies += "org.postgresql" % "postgresql" % "9.4-1201-jdbc41".

    Exist an documentation of migration