播放框架:找不到包play.db.jpa [英] Play Framework: package play.db.jpa not found

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

问题描述

我正在尝试使用Spring Data JPA创建一个play 2.3.4应用程序. 教程说,让我的模型类继承自play.db.jpa.Model .因此,我在代码中添加了import play.db.jpa.*,并让我的模型类从Model扩展.但是,当我重新加载应用程序时,我收到一条错误消息,指出Model是一个未知符号.任何人 知道如何从Model继承吗?

I am trying to create a play 2.3.4 application with Spring Data JPA. This tutorial says it is good practice to let my model class inherit from play.db.jpa.Model. Therefore I added import play.db.jpa.* to my code and let my model class to extend from Model, However, when I reloaded the application, I got an error message, that Model is an unknown symbol. Anybody knows how to inherit from Model?

推荐答案

play.db.jpa.Model在Play2中不存在(只有Ebean ORM的Model类).所以不要扩展该类.实际上,就我所知,即使在Ebean上,扩展它也不会带来任何改善.

play.db.jpa.Model does not exists in Play2 (there is only a Model class for Ebean ORM). So dont extend that class. In fact for what I can tell, even on Ebean, extending it does not bring any improvement.

还要检查libraryDependencies(build.sbt文件)中是否包含以下条目

Also check that you have in your libraryDependencies (build.sbt file) the following entries

javaJpa,
"org.hibernate" % "hibernate-entitymanager" % "4.3.6.Final"

(您可以根据需要将第二个替换为其他实现/版本).之后,您可以在终端中运行activator update.

(you can replace the second with a different implementation/version if you need). After that you can run activator update in the terminal.

在许多情况下,无法在Play2中使用Play1指令. Play1和Play2是两个非常不同的框架.您正在寻找的页面可能是.

Using Play1 instructions in Play2 will not work in many cases. Play1 and Play2 are two very different frameworks. The page you are looking for is probably this.

这篇关于播放框架:找不到包play.db.jpa的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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