[jboss-user] [EJB 3.0] - Entity relationships across persistence-units

jimk1723 do-not-reply at jboss.com
Tue Apr 29 15:39:44 EDT 2008

Hi all,

I'm looking for recommendations, patterns, or examples for setting up relationships between entity beans that span persistence units.  For example, I have a single value unidirectional relationship from class Foo to Bar:

  | @Entity
  | class Foo{
  |   private Bar bar;
  |   @ManyToOne(fetch=FetchType.LAZY)
  |   @JoinColumn(name="BAR_ID")
  |   public Bar getBar();
  | }

Foo is managed by persistence-unit A, Bar is managed by persistence-unit B. My current solution foregos the object relationship and just stores a Long barId in Foo. 

I've read through the ejb3_persist spec for guidance, but there are no examples or indications saying, "Don't do this." If these types of relationships are verboten, what patterns are people using to resolve these types of entity associations?

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

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

More information about the jboss-user mailing list