I'm using Eclipse Facets for JPA 2.0 and Hibernate 4.2 implementation. I think I recall that in previous project I would not have to register an Entity Bean in the persistence.xml. Am I mistaken?
Annotating a POJO (in this case Pub.java) with @Entity will throw the following error in the Eclipse marker/problem view:
Class "com.jacky.webapp.model.Pub" is managed, but is not listed in the persistence.xml file Pub.java /webapp/src/main/java/com/jacky/webapp/model
Any clue? thanks.
As already written here is the solution:
Check you JPA project properties and be sure to select "Discover annotated classes automatically" in the "Persistent class management" section. Doing this should provide the correct validation for your use case.
in jpa you have to compile a file called persistence.xml where you tell Hibernate which classes will be managed by your ORM.
Check this question and its accepted answer
It's possible when you created the project, you picked "JPA project" instead of "java Project". In case you don't see "Java Project", follow the "other" and under the wizard type "java" to see the "Java Project".