• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Use of CMR fields from Client  RSS feed

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question is with reference to the following line from the spec.
"The accessor methods for the container-managed relationship fields must not be exposed in the remote interface of an entity bean." Section 10.3.1, page 129.
If the CMR fields are not exposed to the clients through the remote interface, how can the client program can manipulate or use the relationship data?
Swamy
SCJP1.2, SCWCD
[ October 31, 2003: Message edited by: Swaminath Akella ]
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CMR-fields are maintained by container (Local Only),
Control/Manage CMR-fields are config in Deployment Descriptor(ejb-jar file)

Please see 10.3.6 (Semantics of assignment for relationships) EJB 2.0 Spec
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Swaminath Akella:
My question is with reference to the following line from the spec.
"The accessor methods for the container-managed relationship fields must not be exposed in the remote interface of an entity bean." Section 10.3.1, page 129.
If the CMR fields are not exposed to the clients through the remote interface, how can the client program can manipulate or use the relationship data?
Swamy
SCJP1.2, SCWCD


I'm not an expert but here is my guess:
By using the local interfaces. It is possible for a bean that does not have any remote interface to participate in a relationship. So exposing the cmr fields through the remote interface of the second bean does not make any sense.
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy -- you can't expose the CMR fields through a Remote interface, because the CMR fields are always the local interface of an entity (or a Collection of them). In fact, you can't EVER expose a local interface reference through a Remote method, so really, the rules for CMR in this case aren't any different from any other type of local interface reference.
But... you *can* expose them through a local interface. You probably shouldn't, and won't, since it is nearly *always* better to offer your *own* methods -- exposing ANY of an CMP bean's 'virtual fields' is really an ecapsulation violation, when you think about it.
So, you'll normally have your *own* business methods that are written specifically for the client, and that may *use* your CMR fields, but not retun the value of the CMR field directly.
For example, you might have a Customer bean that has a CMR field for its Address. But the client doesn't/shouldn't know that the Customer's address is another BEAN -- the client just wants the darn *address* in some easy-to-use form -- maybe you'll expose multiple methods to change street, city, zip, whatever or you'll use some kind of value object that just encapsulates the data of the address.
Cheers,
Kathy
 
I knew I would regret that burrito. But this tiny ad has never caused regrets:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!