lookup and create

hi allcan we do lookup and create in a single go, as this will involve dynamic casting of the EJBHome and EJBLocalHome object to the desired interface.
[165 byte] By [javaserverpagea] at [2007-10-2 7:32:13]
# 1
sorryjust in case i am talking about the ejb lookup
javaserverpagea at 2007-7-16 21:11:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
if i were u, i wud try it out and get the answer.
parsifala at 2007-7-16 21:11:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

Hi ,

In EJB 2.1 and earlier, the lookup of the Home is a distinct step from bean creation. This is being addressed in EJB 3.0. In EJB 3.0, session bean Home interfaces are eliminated.The client deals only with the session bean business interface.Here's an example :

// Declare a dependency on a stateful session bean business interface. At component init time, an instance of a stateful session bean will be created and a reference to it injected into "sfulBean"

@EJB SfulBusiness sfulBean;

sfulBean.foo();

--ken

ksaksa at 2007-7-16 21:11:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
thanks but i was wondering how to do it in EJB 2.1i tried it out by writing some classes overiding the classes but it didn't worked
javaserverpagea at 2007-7-16 21:11:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5

> thanks

>

> but i was wondering how to do it in EJB 2.1

You can't. In EJB 2.1 and earlier, the Home is a required part of the client programming model. You need to get the home and do an explicit create() call.

> i tried it out by writing some classes overiding the

> classes but it didn't worked

ksaksa at 2007-7-16 21:11:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 6
thanks for your views
javaserverpagea at 2007-7-16 21:12:00 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...