relationship of various entities in different jars in JBoss 6.1
burgosjc Oct 13, 2011 6:34 PMHi all, I need your great help
I have the following entities each in individual jars in JBoss 6.1.0
jar1.jar contains
@Entity @Table(name = "Table_a") public class EntityA { @id @Column(name = "id_a") private String idA; ... getter and setter }
persistence.xml
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" 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_2_0.xsd"> <persistence-unit name="datos1PU" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/datos1DS</jta-data-source> <class>example.EntityA</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/> </properties> </persistence-unit> </persistence>
jar2.jar contains
import example.EntityA;
@Entity
@Table(name = "table_AA")
public class EntityAA {
@id
@Column(name = "id_aa")
private String idAA;
@ManyToOne()
@JoinColumn(name = "id_a")
private EntityA a;
}
persistence.xml
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" 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_2_0.xsd"> <persistence-unit name="datos2PU" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/datos1DS</jta-data-source> <jar-file>jar1.jar</jar-file> <class>example.EntityAA</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/> </properties> </persistence-unit> </persistence>
to deploy generates this error
ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=jar2.jar#datos2PU state=Create: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on example.EntityAA.a references an unknown entity: example.EntityA
I can not packaged the jar in an EAR because I need the definition of these entities are available for other applications (eg guvnor drools)
any idea