2 Replies Latest reply on Jun 15, 2004 11:24 AM by sbocquet

    EJB 1-N Relationships

    sbocquet Newbie


      I have an 1-N relationship between 2 CMP EJBs, Matches and Leagues, which is set correctly (XDoclet generated). A league can have several matches, and a match can only have one league.

      I'm trying to retrieve the league name, which is a league EJB field, while I'm listing every matches.
      e.g. :
      team 1 vs team 2 - League 1
      team 3 vs team 4 - League 2...

      Here is the descriptor for the relationship.

       <ejb-relation >
       <ejb-relationship-role >
       <relationship-role-source >
       <cmr-field >
       <ejb-relationship-role >
       <relationship-role-source >
       <cmr-field >

      I have a finder in the League EJB, which can retrieve all the matches of a League
       * @ejb.finder signature="java.util.Collection findMatches(java.lang.String aLeagueId)"
       * query = "SELECT OBJECT(M) FROM League L, IN (L.match) AS M WHERE L.LeagueId = ?1"

      But I don't know how to have the League name while I'm listing the matches!!!...
      Perhaps, I have pissed something with XDoclet ?
      Can someone help me?

      Thanks a lot