bozo
bozo

Reputation: 946

What is the correct pattern for dynamically determining EJB to access?

EJB A has to access few other EJBs, all implementing a same business interface.

Is JNDI lookup the only way to dynamically lookup those EJBs, or is there some simpler way?

Upvotes: 0

Views: 54

Answers (3)

Jan Martiška
Jan Martiška

Reputation: 1314

I am afraid, if you need to determine the EJB at runtime, there is no better way than a JNDI lookup.

Upvotes: 1

Gabriel Aramburu
Gabriel Aramburu

Reputation: 2981

A client needs the stub object to call the methods offered for an EJB. The JNDI service helps to store and to recover the EJB's stub deployed in the appserver.

If you dont use JNDI, the alternative is to create by yourself the stub object but I don't think this is easyer or simpler than the JNDI approach.

Upvotes: 0

ZeusSelerim
ZeusSelerim

Reputation: 945

Maybe I' not understanding the question but you could use @Inject or @EJB instead of doing a lookup since JEE5/6

Upvotes: 0

Related Questions