Playframework 2.1找不到javax.persistence和play.db [英] Playframework 2.1 doesn't find javax.persistence and play.db

查看:48
本文介绍了Playframework 2.1找不到javax.persistence和play.db的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Play框架(版本2.1)创建实体的Scala教程中遇到问题.我正在尝试:

I have a problem with the Scala tutorial for creating an Entity with the play framework (Version 2.1). I'm trying to do:

import java.util._
import javax.persistence._
import play.db.jpa._

但是当我编译它时,它告诉我javax.persistence不存在,而play.db都不存在.

But when I compile it tells me that javax.persistence dosen't exist and play.db neither.

我认为这是版本问题,因为在我看来,实际的yabe教程有点旧.您知道哪个网站提供了很好的解释和示例吗?

I suppose it's a problem of version because it seems to me that the actual yabe-tutorial is a bit old. Do you know any website who has good explanations and examples?

感谢您的帮助!

推荐答案

在使用Scala时,您可以看看Slick,它似乎是Play的未来数据库持久性框架,并在您的教程中放弃了.

As you use Scala you could take a look at Slick which seems to be the future db persistence framework for Play and abandon the one in your tutorial.

如果有jdbc作为依赖项,请查看Build.scala.

Look in your Build.scala if you have jdbc as a dependancy.

这是我的依赖

val appDependencies = Seq(
    jdbc,
    "mysql" % "mysql-connector-java" % "5.1.22",
    "com.typesafe" % "slick_2.10.0-RC1" % "0.11.2",
    "org.mindrot" % "jbcrypt" % "0.3m"
  )

这篇关于Playframework 2.1找不到javax.persistence和play.db的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆