[jboss-user] [EJB 3.0] - entity relationship from several jars

deady_ do-not-reply at jboss.com
Thu Jun 7 03:43:13 EDT 2007


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:
anonymous wrote : 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?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4051989#4051989

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4051989



More information about the jboss-user mailing list