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.
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.