users@glassfish.java.net

Re: EJB 3.0 self-reference

From: <glassfish_at_javadesktop.org>
Date: Wed, 17 Feb 2010 07:08:26 PST

The EJB specification doesn't explicitly restrict it, but the behavior associated with injection rules it out for stateful session beans. Injection or lookup of a stateful session bean reference is required to have the side effect of creating a new stateful session bean instance. Bean instance creation results in injection, which would cause inifinite recursion.

There are no problems with acquiring a reference to ones own bean via @EJB for stateless or singleton beans. The other easy way to acquire a reference to ones own bean is through the SessionContext.getBusinessObject() method.
[Message sent by forum member 'ksak' (kenneth.saks_at_sun.com)]

http://forums.java.net/jive/thread.jspa?messageID=387181