Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The given name of the entity "ClassName" is empty

Tags:

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.

Suddenly the @Entity annotation is highlighted as an error and the associated error message is:

The given name of the entity "com.test.domain.Result" is empty.

If I specifically add the name attribute (i.e. @Entity(name="somename") then the "somename" part of the line is highlighted as an error.

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?


Update:

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.

like image 841
David Avatar asked Jul 16 '13 11:07

David


3 Answers

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.

like image 53
David Avatar answered Oct 17 '22 19:10

David


It is an issue with Eclipse JPA Validator not recognizing @ElementCollection, if I remove this annotation all 21 errors are gone from eclipse, I removed because I do not need it anymore, have replaced it with an entity.

like image 4
Claudio Miranda Avatar answered Oct 17 '22 19:10

Claudio Miranda


I have the same problem in my project. My app deploy without errors in my app server... it seems to be a validation bug. I removed JPA facet from 'Project properties -> Project facets'. You could turn off 'JPA validation' instead.

like image 4
Ariel Carrera Avatar answered Oct 17 '22 17:10

Ariel Carrera