[jboss-user] [EJB 3.0] - Re: How to access a join table column?!

abl do-not-reply at jboss.com
Tue Jul 25 07:07:03 EDT 2006


no - you have to deal with your m:m entity. you will have something like (was misleading in first post - sorry):

@Entity
  | class PartnerToRate
  | {
  |    Partner partner;
  |    ...
  | 
  |    @ManyToOne
  |    Partner getPartner()
  |    {
  |       return partner;
  |    }
  | ...
  | }
and in Partner:

@OneToMany( mappedBy="partner")
  | List<PartnerToRate> getPartnerToRates()
  | {
  |    return partnerToRates;
  | }
of course you can add additional getter like:

@Transient
  | List<Partner> getPartners()
  | {
  |    List<Partner> ret = new Arraylist<Partner>();
  |    for( PartnerToRate p2r : partnerToRates)
  |       ret.add( p2r.getPartner());
  |    
  |    return ret;
  | }
ok?

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

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



More information about the jboss-user mailing list