-
1. Re: wildfly 9, deploy, resource path
andey Jan 16, 2017 9:13 AM (in response to joinedserg)1 of 1 people found this helpfulHi,
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:
<mapping resource=".../EntityTest.hbm.xml"/>
In persistence.xml, transaction-type must be set to RESOURCE_LOCAL (default being JTA). Furthermore, the datasource is non JTA, use of
<non-jta-data-source>java:/repository_hibernate</non-jta-data-source>
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.
-
2. Re: wildfly 9, deploy, resource path
joinedserg Jan 16, 2017 6:13 PM (in response to andey)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).
-
3. Re: wildfly 9, deploy, resource path
andey Jan 17, 2017 7:39 AM (in response to joinedserg)Hi,
- 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?
-
4. Re: wildfly 9, deploy, resource path
joinedserg Jan 18, 2017 2:43 PM (in response to andey)- 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.