• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

unable to access cmr field

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.
I have the following cmp entity beans: TeamBean and PlayerBean
the relationship is 1 : * (one team, many players) bidirectional.
the TeamBean has to CMR field: getPlayers( ) and setPlayers(Collection)
and I have a session bean LeagueBean (session facade) and this bean has
the following method :

but when calling findPlayersWithinTeam method, nothing displayed at all,
and there is no exception.
so I think maybe because getPlayers is CMR field so I can't use it outside.
so I created the following method in TeamBean:

and the EJBQL for ejbSelectPlayers method is :
SELECT OBJECT(P) FROM TeamBean AS T, in (T.players) AS P WHERE T = ?1
and calling findPlayersWithinTeam method, nothing displayed and no exception !!
WHY ???
How can I get the players for a specific team ??
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Help PLEASE ...............
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Everything looks good to me. Can you successfully add and retrieve regular items from your CMR collection? Your EJB-QL looks fine to me. Have you done any testing, or were you expecting somebody (me?) to just jump in here and fix it all for you?
 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
John, I finally got my RI fixed and just like I said offline, you are responsible for implementation of all of your "set" methods, and it looks like the only ones you did were the cmp fields. Nobody in the universe is calling "setPlayerTeam(TeamLocal team)", nor is anyone calling "setPlayers(Collection col)". See where TeamBean has two sets called in the ejbCreate, but three virtual get/set pairs? Same in PlayerBean. Four set methods called, but five get/set pairs. The missing ones, of course, are the cmR fields, and as you pointed out, you do that in the ejbPostCreate (ejbCreate is too soon because you have to wait until after the data has been inserted). So in each of your post creates, you would lookup the other guy's home, call a method on the home with whatever key you have in your parameter list, and you get back whatever the input parameter for your set method would be.
The application works as long as you have capslock "on" for your keys. I'm not sure what's going on there, but I don't think it matters.
--Dale--
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic