0 Replies Latest reply on Aug 10, 2002 11:53 PM by Cokorda Raka Angga Jananuraga

    J2EE Tutorial, CMP Example, RosterApp

    Cokorda Raka Angga Jananuraga Newbie

      Hi guys,

      I've just learnt again the J2EE Tutorial, the chapter on CMP. (D:\CurrentReadings\J2EE Tutorial\doc\CMP2.html, "Overview of the RosterApp Application").

      There's an illustration about relationship among enterprise beans on that page.

      At first, it wasn't too obvious for me why there's no thick line that connects PlayerEJB with LeagueEJB (thick line denotes a CMR relationship, right?).

      Then, I saw that if I connected those 2 things using CMR, there would be a circular relationship going in the following direction: LeagueEJB -> TeamEJB -> PlayerEJB -> LeagueEJB -> ...

      Could it be the real reason why Player is not connected with League using CMR? (instead, in the example, business method is used, wrapping around the select method -- getLeagues() wraps ejbSelectLeagues(),... see LocalPlayer and PlayerBean -- to enable user to navigate from Player to League)...; to break the circular relationship. ???

      Hmm....

      The question above raises another (perhaps more substantial) question:

      "When to declare relationship as CMR (relationship method) and when to declare it as business method?"

      Example:

      We could've declared getLeagues() as relationship method (instead of business method) in LocalPlayer. But we didn't do that.

      If we go a little further with the thinking (maybe to the extreme)... we'll come to this question: "we can declare relationship as business method [that wraps ejb select method], right?".

      What's the benefit of each of those approach over the other?

      I'm sure I've missed something about entity bean design... but I don't know what it is exactly :) Can you help?

      Thanks in Advance,
      Raka