向persistence.xml添加新类会抛出java.lang.IllegalArgumentException:Object:Restaurants {id = null,name = Subway}不是已知的实体类型

时间:2015-10-11 15:57:41

标签: jpa entity eclipselink illegalargumentexception persistence.xml

我创建了一个新的实体类,并将其添加到persistence.xml文件中。

<class>xxx.xxx.xxx.xxx.xxx.Restaurants</class>

尝试在Maven中构建时,我收到此错误:

Caused by: java.lang.IllegalArgumentException: Object: Restaurants{id=null, name=Subway} is not a known entity type.

这是如何引起的,我该如何解决?其他实体类没有问题,只有这一个。

1 个答案:

答案 0 :(得分:0)

在我们的一些应用程序中,我们使用Maven构建配置文件,这些配置文件使用不同的persistence.xml文件进行测试,生成等。http://maven.apache.org/guides/introduction/introduction-to-profiles.html