Reputation: 3652
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.
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.
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.
Is there a web.xml entry that has vanished, or a Spring configuration entry that has accidentally been deleted?
Upvotes: 0
Views: 25705
Reputation: 193
Is this happening for one specific class (few classes) or all the entity classes. The persistence.xml file has a list of class and or jar files that need to be scanned for @Entity mappings. If it was working earlier you can do a quick diff with the version of persistence.xml that was working correctly. Another issue could be that it is picking up a different persistence.xml file - you can verify this by introducing an error (for e.g., make the xml invalid) in the persistence.xml.
Upvotes: 0
Reputation:
verify in your entity classe that you import javax.persistent.Entity and not org.hibernate.annotations.Entity
Upvotes: 5
Reputation: 50297
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?
Upvotes: 2