【发布时间】:2015-02-19 04:56:41
【问题描述】:
我正在使用 jpa 和 Play 2.2.1 java。我有一个方法可以找到所有求职者
我的控制器功能
@Transactional
public static Result index() {
return ok(views.html.admin.jobseeker.render("Your new application is ready.", Jobseekers.all()));
}
和模型方法
public static List<Jobseekers> all() {
@SuppressWarnings("unchecked")
List<Jobseekers> el = JPA.em().createQuery("from Jobseekers order by id").getResultList();
return el;
}
但是我遇到了异常
[RuntimeException: No EntityManager bound to this thread. Try to annotate your action method with @play.db.jpa.Transactional]
即使我添加了@Transactional,我也不知道为什么会出现此错误
有人可以帮帮我吗?
谢谢
【问题讨论】:
标签: java jpa orm annotations playframework-2.2