[jboss-user] [JBoss Seam] - Re: Illegal use of mappedBy on both sides of the relationshi

quilleashm do-not-reply at jboss.com
Sun Mar 25 16:40:10 EDT 2007


The @ManyToMany definition on one of the sides is incorrect.  For bidirectional relationships one side must be the owner.  The side using "mappedBy" is the inverse side, which means it updating it does NOT update the relationship.

If this was generated it's probably a seam gen bug.  To fix your generate objects you'll need to do the following to ONE of the @ManyToMany's.

1) Remove the mappedBy attribute
2) Add a @JoinTable

So updating A to be the owner side does this.  B would be unchanged.  If you want B to be the owner side do the same but swap A_ID and B_ID round in the joinColumns/inverseJoinColumns attributes.


  | @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
  | @JoinTable(
  |         name="C",
  |         joinColumns={@JoinColumn(name="A_ID")},
  |         inverseJoinColumns={@JoinColumn(name="B_ID")}
  |     )
  | 

Submit a bug report JIRA and I'm sure something will fix it, although guessing the owner side will be fun.

HTH.

Mike.

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

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



More information about the jboss-user mailing list