Restriction: An EJB must not pass this as a method argument or result....
Motivation: The container may use a proxy mechanism to control concurrent access of the EJB instance. The reference injected into clients of the EJB is a reference to the proxy and not to an instance of the EJB implementation class.
I think "the reference injected into clients of the EJB is a reference of proxy" applies to Singleton and stateless bean, but not stateful bean..
Message driven bean cannot be injected by the client as the client does not use any MDB directly. So, this case does not apply to MDB.
According to the JSR 318 and EJB in Action :
posted 4 years ago
Let e answer my question.
In ejb in action, p.131,
"When a container injects am ejb,what really gets injected ? The answer is a proxy."
For stateless bean, the reference to the beans refer to the same object. For stateful bean, the references of the bean refer to different objects. The proxy handles that.
This parrot is no more. It has ceased to be. Now it's a tiny ad: