我正在使用jpa与Play 2.2.1java .I有一个方法,可以找到所有的求职者
我的控制器函数
@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
有人能帮我吗??
谢谢
发布于 2014-12-20 19:44:03
正确的注解是@Transactional而不是@Transaction
https://stackoverflow.com/questions/27579881
复制相似问题