“未找到名称为'product'的持久性单元” [英] "No persistence unit with name 'product' found"

查看:135
本文介绍了“未找到名称为'product'的持久性单元”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近完成了本教程: http:// static。 springource.org/docs/Spring-MVC-step-by-step/ ,但现在我希望它能够与Hibernate和注释一起工作。我知道我很接近,但我遇到了障碍,我无法弄清楚。我已将自己的代码发布到Spring论坛此处 。我非常感谢任何帮助。谢谢

我试图将注释和hibernate合并到它中,但是我遇到了一个问题,我无法弄清楚。我不断收到没有找到名称为'product'的持久性单元的错误。你需要一个 META-INF / persistence.xml

code>,其中< persistence-unit name =product> 请看这里



(我通常把它放在 WEB-INF / classes / META-INF 中。 maven你可以把它放在 src / main / resources / META-INF


I recently completed this tutorial: "http://static.springsource.org/docs/Spring-MVC-step-by-step/", but now I want it to work with Hibernate and annotations. I know I'm close but I've hit a roadblock and I can't figure it out. I've posted my code on the Spring forums here. I would greatly appreciate ANY help. Thanks

I'm trying to incorporate annotations and hibernate into it, but I've run into a problem and I can't figure it out. I keep getting errors of "No persistence unit with name 'product' found". ANY help would be greatly appreciated.

解决方案

You need a META-INF/persistence.xml, with <persistence-unit name="product">. See here

(I usually put it in WEB-INF/classes/META-INF. As noted in the comments, with maven you can place it in src/main/resources/META-INF)

这篇关于“未找到名称为'product'的持久性单元”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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