1 of 1 people found this helpful
double check persistence.xml and the datasource, everything must be well configured and compatible
check that there is no unqualified entity name duplication (same entity name but different package)
For org.hibernate.MappingException: Unknown entity:my.mapping.myobj
If user is using only Hibernate API not JPA API in application then check hibernate.cfg.xml file
It seems user didn't have configure mapping for the object my.mapping.myobj.
The configuration file hibernate.cfg.xml should contain the mapping to the resource <EntityTest.hbm.xml.
In hibernate.cfg.xml user need to configure:
In persistence.xml, transaction-type must be set to RESOURCE_LOCAL (default being JTA). Furthermore, the datasource is non JTA, use of
In case you want to use JTA it should have to:
either use Container Managed Transaction (CMT) session bean.
or manually use the UserTransaction (jndi look up).
Check whether table name, database name are properly mapped or not in all Entity classes. Also check Hibernate with DB related jars whether it is compatible or not.
My suggestions must be right, but my project is mostly annotation-based and I'm also using springboot, so I don't have hibernate.cfg.xml or persistence.xml.
But I bumped into special case which can not be covered with annotations and this is the reason why I use EntityTest.hbm.xml mapping (it's all about multimaps mapping, see https://hibernate.atlassian.net/browse/HHH-4417).
My project successfully starts with embedded tomcat by gradle run (so there is no problem with hibernate or JPA), but when I try to run on wildfly, I have unknown entity exception.
Well, all in all, I think there is a problem on the wildfly side (wildfly don't see resourses path).
- Which version of Hibernate you're using?
- How are you using Hibernate? Are you packing your own hibernate jars in your application or are you using the specific version of Hibernate bundled/shipped with the specific wildfly 9 release?
- hibernate 4.3.1-Final
- spring boot is responsible for dependencies in our application, so hibernate is already packed in our application.
Now our problem is temporary solved by using embedded tomcat.