• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can i create a session bean without using create() method??  RSS feed

 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can i create a session bean without using create() method?

or without using home interface??

please calrify..

thanks in advance
 
Balamaci Serban
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well it goes like this i belive.
The home interface is a factory for a EJBObject, you need to call create() on the home interface in order for the container to create a new EJBObject or to reuse an instance that was servicing another client. U see when you invoke a method on your bean, the method it's not invoked on the bean itself as u can see the bean class does not implement Remote so it cannot be called directly from the client. The client executes the method on the EJBObject which is either created by the continer when u called create on the session bean home interface, or reuse an existing instance that has been pooled by the container, just so it won;t have to go to the trouble of creating a new instance. EJBObject is your bean with the container magic contained in it: security management,transaction management, bla bla bla so when u call a method on the bean the container could intervine before, after,... the bussiness method is processed. There is no need to call create() on the EJBObject. Lookup Home, call HomeInterface.create() call bussiness method on EJBObject.
[ July 17, 2005: Message edited by: Balamaci Serban ]
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The client gets an EJBObject stub when it calls create() on the home interface. The stub provides remote EJB access for the client as it is an IIOP proxy to the EJBObject. For a stateless session bean or entity bean, the EJBObject will almost certainly have existed long before the client.

In a clustered configuration, the stub lists all of the servers in the cluster to which the bean should be deployed. As a stateless bean holds no state on behalf of the client, the stub is free to route any call to any server that hosts the bean.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!