Hibernate / JPA Annotations - Unknown Object
An app that worked well for months stopped collecting JPA annotations @Entity
that had been part of it for months. As I run my integration tests, I see dozens of " org.hibernate.MappingException: Unknown entity: com.whatever.OrderSystem
" errors .
It is not clear to me what is wrong here.
I don't have a file hibernate.cfg.xml
because I am using Hibernate Entity Manager. Since I exclusively use annotations, there are no .hbm.xml files for my objects. My file persistence.xml
is minimal and lives in META-INF
as intended.
I obviously missed something, but I can't push it.
I am 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 part of the POM project, but I don't know if this is consistent.
Is there a lost web.xml entry or a Spring configuration entry that was accidentally deleted?
source to share
I seem to have remembered that I had a similar problem in one go.
Its a long shot, but if you don't already, have you explicitly indicated the vendor you are using?
<persistence ...>
<persistence-unit ...>
<provider>org.hibernate.ejb.HibernatePersistence</provider> <---- explicit setting
....
</persistence-unit>
</persistence>
Otherwise, I'm not sure?
source to share
This happens for one specific class (multiple classes) or all entity classes. The persistence.xml file contains a list of class and / or jar files that need to be scanned for @Entity mappings. If it worked before, you can quickly deploy the persistence.xml version that works correctly. Another problem might be that it is collecting a different persistence.xml file - you can check this by introducing an error (like invalidating the xml) in the persistence.xml file.
source to share