سؤال

I'm trying to make Scala application using play framework for interaction with database. But I am not good at this. I used tutorials: http://www.hars.de/2009/03/jpa-with-scala.html , http://www.avaje.org/topic-137.html But then I tried to make entity:

package models

import java.util._
import javax.persistence._

@Entity
@Table(name="persons")
case class person(name: String, lastName: String, age: Int) {
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  var id : Int = _  
}

I got next errors:

-object persistence is not a member of package javax
-not found: type Entity
-not found: type Table
-not found: type Id
-not found: type GeneratedValue

Can someone help me?

build.sbt :

name := "Project"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
  jdbc,
  anorm,
  cache,
  javaEbean,
  javaJdbc
)
play.Project.playScalaSettings

Come on, guys, please. It must be something simple. If you need more information about my problem, then just ask.

هل كانت مفيدة؟

المحلول

I already decided to use Anorm instead of EBean, but I guess I understood what the problem was and it was pretty stupid. I just needed to run:

play eclipse

in project directory after editing build.sbt file and refresh the project. This should fix the problem.

نصائح أخرى

You are missing the entitymanager. Add the following dependencies to your build.sbt:

javaJpa,
"org.hibernate" % "hibernate-entitymanager" % "4.3.4.Final"
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top