7 Replies Latest reply on Jul 13, 2007 1:00 PM by simon_lebettre

    entity relationship from several jars

    deady_

      I have
      1. Client entity in client.jar:

      package object;
      @Entity
      public class Client { ... }


      2. GuestbookEntry entity in guestbook.jar.
      package object;
      @Entity
      public class GuestbookEntry {
       ...
       @ManyToOne
       public Client getClient() {...}
      }
      



      now I try to deploy these jars.
      First guestbook.jar is deployed before client.jar and JBoss can't find class object.Client. How can I tell that guestbook.jar depends on client.jar and must be deployed after it?

      If I redeploy guestbook.jar after client.jar is deployed, I get exception:
      org.hibernate.AnnotationException: @OneToOne or @ManyToOne on object.Entry.client references an unknown entity: object.Client


      I added
      <?xml version="1.0" encoding="UTF-8"?>
      <persistence xmlns="http://java.sun.com/xml/ns/persistence">
       <persistence-unit name="unit">
       <jta-data-source>java:/datasource</jta-data-source>
       <class>object.Client</class>
       </persistence-unit>
      </persistence>
      

      and now every time I deploy guestbook.jar I can see that jboss binds Client entity, but it was already binded when client.jar was deployed. Does it creates on more pool for it?

      Let's assume that Client has some relations with other entities from client.jar, now to deploy guestbook.jar I have to add
      <class>object.<CLASS_NAME></class>

      lines for each relation class and they also get rebinded.

      How can I tell that guestbook.jar must use entities from client.jar?