Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why cant we declare business methods in session beans?

 
Sudhakar Reddy Kurakula
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to get be clarified , why cant we decalre the business methods in homeinterface like remote interface in session beans.
 
Bunty
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Not sure about this but intutively I can say, :roll:
If we declared business method in Home Interface of session Bean. Then bean provider need to define those method in Session Bean.In that case the specification needs to mandate the bean provider to implemenation business method in such a way that it should maintain the client specific details.(Line in the case of Stateful Session Bean client specific details are managed by container). And the client specific details are attached to the session bean but not the Session Home.

So ultimately you have to define the business method in Component interface(which extends EJBObject)

Hope it helps.....
 
Arun Natarajan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The home interface for creating instances of the beans, why do you want to put business methods in the home interface? It is a different case for entity beans, because with entity beans you would want to do non-bean specific things for which you need to write business methods in the remote interface.
 
Harsh Ravindra Gupta
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I have something to add here.
Though it is based on intuition rather than information.
Its actually the container which implements the Home interfaces and creates
concrete classes and stubs which are used by clients.In case of entity beans
the container expects Business methods in home and accordingly generates the implementation class to handle such business mehthods. If we try to add home methods in the session bean home the container has no directions from the spec about how to handle this.It might give you a specific error saying that it is not allowed or it might quietly generate the implemention class and give you compile time error saying that the generated class does not implement all the methods from that home interface or anything might happen.
You can try this scenario in various app servers to confirm.
I will try it as soon as i can and will give you updates.

Regards
Harsh Gupta
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic