It's not a secret anymore!
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes State for local clients Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "State for local clients" Watch "State for local clients" New topic

State for local clients

Justin Russo
Ranch Hand

Joined: Oct 21, 2007
Posts: 77
I read this in the specs

The Bean Provider must be aware of the potential sharing of objects passed through local
interfaces. In particular, the Bean Provider must be careful that the state of one enterprise
bean is not assigned as the state of another. In general, the references that are passed across
local interfaces cannot be used outside of the immediate call chain and must never be stored as
part of the state of another enterprise bean. The Bean Provider must also exercise caution in
determining which objects to pass across local interfaces. This caution applies particularly in
the case where there is a change in transaction or security context.

can someone help me understand, why state shouldn't be maintained across local calls.

You Want it.. Get it.......the Right Way...<br /> <br />SCJP 5.0 SCWCD 5.0
Christian Nicoll
Ranch Hand

Joined: Mar 09, 2008
Posts: 106
Hi Justin,

I think this part of the spec is caused by the two different ways like parameters are handled.

If you have a local client then in the Bean you will work with an copy of the reference, so every changes to you do in the bean, will affect the objects of the caller. Otherwise, if you 've remote clients, the bean will work with an copy of the values and so will never affect the orginal values of the callers object.

Hoping this helps.

My SCBCD-Notes - My Hello World Webservice
I agree. Here's the link:
subject: State for local clients
It's not a secret anymore!