문제

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