Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Use of CMR fields from Client

 
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
 
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic