There is an application that is migrated from jboss 4.3 to Jboss 7 CR1b. There are several ejb-jar modules, each module with one persistence.xml, in an ear package.All of the persistence.xml files have the same unit-name.
The problem is that the entity classes can not be found when it refers to a different module even though the module/jar is included with <jar-file> in persistence.xml. This cuases errors during deployment like:
Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on my.com.infopro.icba10.kernel.security.transaction.domain.UserLimit.user references an unknown entity: my.com.infopro.icba10.kernel.userprofile.domain.User
Or like this one after successful deployment
Caused by: java.lang.IllegalArgumentException: Unknown entity: my.com.infopro.icba10.kernel.activitytrail.domain.ActivityLog
Once the entity that cuased the error is added to the persistence.xml the error will be resolved.
This is a persistence.xml of one of the modules:
<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="entityManager" transaction-type="JTA"> <jta-data-source>java:/ICBA10DS</jta-data-source> <jar-file>../../iicba10-kern-userprofile-ejb.jar</jar-file> <jar-file>../../iicba10-kern-audittrail-ejb.jar</jar-file> <!-- <class>my.com.infopro.icba10.kernel.userprofile.domain.User</class> <class>my.com.infopro.icba10.kernel.activitytrail.domain.ActivityLog</class> --> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect" /> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/> </properties> </persistence-unit> </persistence>
I already noticed about this issue: https://community.jboss.org/message/635691
So I shoould expect the fixes have been appliyed also to the current version (Jboss 7 CR1b) that I am using. but I still have the similar problem with the difference that i have multiple persistence.xml in the ear.
As far as the that above config works fine in Jboss 4.3. why it needs each enity class from different module to be included in persistence.xml in Jboss 7?
I will be very thankful for your help.