休眠/ JPA注解 - 未知实体 [英] Hibernate/JPA Annotations -- Unknown Entity

查看:136
本文介绍了休眠/ JPA注解 - 未知实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这已经好几个月运作良好的应用程序已经停止拿起JPA @Entity 已是它的一部分几个月注解。正如我的集成测试来看,我看到几十个 org.hibernate.MappingException:未知实体:com.whatever.OrderSystem 类型错误

An application that has been working well for months has stopped picking up the JPA @Entity annotations that have been a part of it for months. As my integration tests run I see dozens of "org.hibernate.MappingException: Unknown entity: com.whatever.OrderSystem" type errors.

这是我不太清楚什么出了错这里。

It isn't clear to me what's gone wrong here.

我没有的hibernate.cfg.xml 文件,因为我使用Hibernate的实体管理器。由于我只使用注释,也有我的实体没有的.hbm.xml文件。我的的persistence.xml 文件是最小的,住在 META-INF ,因为它应该。

I have no hibernate.cfg.xml file because I'm using the Hibernate Entity Manager. Since I'm exclusively using annotations, there are no .hbm.xml files for my entities. My persistence.xml file is minimal, and lives in META-INF as it is supposed to.

我显然失去了一些东西,但不能把我的手指上。

I'm obviously missing something but can't put my finger on it.

我使用的Hibernate 3.2.1注解,休眠,EntityManager的3.2.1,持久性API 1.0和休眠3.2.1。休眠公地的注解也是该项目的POM的一部分,但我不知道这是相关的。

I'm using hibernate-annotations 3.2.1, hibernate-entitymanager 3.2.1, persistence-api 1.0 and hibernate 3.2.1. hibernate-commons-annotations is also a part of the project's POM but I don't know if that's relevant.

有一个web.xml条目已经消失,或已不小心被删除的Spring配置项?

Is there a web.xml entry that has vanished, or a Spring configuration entry that has accidentally been deleted?

推荐答案

我似乎记得我有一个类似的问题在同一时间。

I seem to recall I had a similar issue at one time.

它是一个长镜头,但如果你不是已经这样做了,你有没有明确指定要使用的供应商?

Its a long shot, but if you're not already doing this, have you explicitly specified the provider you are using?

<persistence ...>
   <persistence-unit ...>
      <provider>org.hibernate.ejb.HibernatePersistence</provider> <---- explicit setting
      ....
   </persistence-unit>
</persistence>

否则,我不知道?

Otherwise, I'm not sure?

这篇关于休眠/ JPA注解 - 未知实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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