实体“ClassName”的给定名称是空的 [英] The given name of the entity "ClassName" is empty
问题描述
我在Eclipse(开普勒)中使用JPA,而我的实体豆会偶尔开始显示错误,尽管班上没有任何变化。
I am using JPA in Eclipse (Kepler) and my Entity Beans will occasionally start showing errors although nothing has changed in the class.
突然间,$ code> @Entity 注释突出显示为错误,相关的错误消息是:
Suddenly the @Entity
annotation is highlighted as an error and the associated error message is:
给定的名称实体com.test.domain.Result为空。
The given name of the entity "com.test.domain.Result" is empty.
如果我特别添加了name属性(即 @Entity(name =somename)
然后线的somename部分突出显示为错误。
If I specifically add the name attribute (i.e. @Entity(name="somename")
then the "somename" part of the line is highlighted as an error.
清理项目,重新启动Eclipse不能解决这个问题,我可以将类复制到一个新项目中,而不是一段时间得到错误,但一旦出现(没有明显原因),我无法摆脱它。
Cleaning the project, restarting Eclipse does not fix this. I can copy the classes into a new project and not get the error for a while, but once it appears (with no apparent cause) I cannot get rid of it.
任何想法是什么导致的,我可以如何解决?
Any ideas what is causing it and how I can fix it please?
更新:
嗯,我可以在项目属性中找到一个特定的设施(或忽略!)(项目属性 - > JPA - >错误/警告 - >键入实体名称为空(列表中的第二个)。一切正常,如果我这样做,但我仍然想知道是什么导致错误在第一位。
Well, I can find in the project properties a facility to specifically set this error to warning (or ignore!) (Project Properties -> JPA -> Errors/Warnings -> Type "Entity Name is Empty" (2nd one down in the list). Everything works fine if I do this, however I am still wondering what is causing the error in the first place.
推荐答案
我可以在项目属性中找到一个专门将此错误设置为警告(或忽略!)的工具(项目属性 - > JPA - >错误/警告 - >键入实体名称为空(列表中第二名)
I can find in the project properties a facility to specifically set this error to warning (or ignore!) (Project Properties -> JPA -> Errors/Warnings -> Type "Entity Name is Empty" (2nd one down in the list.
稍后取消设置实际上并不会导致错误返回,我猜,日食与自己不一样。
Unsetting this later actually doesn't cause the error to return, I am guessing eclipse gets out of sync with itself.
这篇关于实体“ClassName”的给定名称是空的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!