1
votes

So I'm trying to create a database with mySQL and Play Framework version 2.7x following the tutorial from Radix Code. I read the episode Play Framework Tutorial # 21| Enable Ebean ORM & JDBC Support where we implement Ebean to connect it to wamp and MySql. I understand that the version he is using on the video is outdated, and Ive used packages more recent, and also compared to other peopels codes, including Radix'own, but continue to have the error

[error] C:\Users\Documents\GitHub\play-java-hello-world-tutorial\app\models\Escuela.java:4:1: package io.ebean does not exist [error] import io.ebean.*;

Here is asnippet of my plugin

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.2.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "4.0.6")

Here is a snippet of my build.sbt

version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean)

scalaVersion := "2.12.8"

libraryDependencies ++= Seq(

jdbc,

javaJdbc,

guice,

cache,

javaWs,

"mysql" % "mysql-connector-java" % "5.1.41",

"org.avaje" % "ebean" % "2.7.3",

"javax.persistence" % "persistence-api" % "1.0.2"

)

I've also tried it without the "org.avaje" % "ebean" % "2.7.3", and

"javax.persistence" % "persistence-api" % "1.0.2"

for my application.conf i have the following:

ebean.default = ["models.*"]

play.evolutions {

  db.default.enabled = true

}

and I have two models, which I suspect may be the problem. I'm still learning Sql so I want to create 2 tables but they are connected with one foreign key(which is the primary key of the other table). they otherwise function the same. Of course i'm still using hashsets instead of the actual database tables. I'm only editing one model at a time so this error is appearing on only one model. In the model class i have the following:

package models;

import java.util.Set;

import java.util.HashSet;

import io.ebean.*;

I have not extended the Model library to my class so its just:

public class Escuela  { ... }

*Additional info: Even though I have Eclipse, I'm editing everything through visual studio code. Im also using the hello world template and editing it, so that could also be an issue.

1
Did you solve in the end?LppEdd

1 Answers

0
votes

Edit: have you run the SBT update command to download the dependencies?


Not a Play Framework user, however I was having a look at the Play EBean documentation, and this is what I found. Could it be related to version compatibility?

enter image description here

Also, as described in the EBean documentation, you might want to add

libraryDependencies += "io.ebean" % "ebean" % "11.22.10"

However on this point I'm not sure, as the Play Framework site says

Play comes with the Ebean ORM. To enable it...