• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

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

 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic