Calling session bean from within another session bean.

I have a session bean that needs to call another session bean's methods. What is the best way to access another session bean from within a current session bean's. I assume that I would use the local interface for this.

Thanks in advance.

[252 byte] By [aacaina] at [2007-11-27 10:58:58]
# 1

The client EJB programming model is exactly the same, regardless of whether the caller is itself an

EJB, or is a different kind of Java EE component such as a servlet or Application Client.

If the client EJB is in the same application as the target EJB, the simplest approach is to use an

@EJB annotation to inject a local EJB reference. If the local business interface is Foo that would look

like this :

@EJB

private Foo fooRef;

ksaksa at 2007-7-29 12:19:53 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...