Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Ejb does not implement remote interface.

 
Thilak Prakash
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why doesn't an EJB implement remote interface? and still provide an implementation for the business methods.
 
Sunil Dixit
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prakash,
The reason is very simple.As you must be knowing that your remote inteface contains user business methods + other containner/remote related methods like getHandel,delete... may few more...(defined in javax.ejb.EJBObject).So if you implement business interface in your bean than you have give implementation of user business methid plus container related method,which is very complicated. Thats the reason you never implement your businees interface.
When you depoly your EJB,container will generate all code for you.
hope that this will answer your question.

Sunil
 
Thilak Prakash
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you sunil. That seems to be the best explaination for this question
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Conceptually , the bean is not a remote object , so if your bean implements EJBObject then that becomes remote and thats wrong.But you can have a service interface that is extended by both component interface and implemented by your bean class.
 
Sunil Dixit
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rahul,

Thanks a lot for adding complement in the soln but you need to understand tilak is not asking how we can force are code to implement remote interface.
But I think you forgot one thing in your explanation which it is not practically possible if your bean has local and remote interface.


Sunil
J2EE (SCEA)
 
Jetendra Ivaturi
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to add few things to this, what sunil said is right.

Along with, Our aim is not to trouble the bean. Meaning we are not supposed to acess the bean directly. That is the reason we have EJBObject.

So what ever the business methods we have we try to access thru EJBObject.

I mean to say it acts as an interface between the client and bean.

If Bean extend the Remote Interface, It becomes normal RMI application.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sunil Dixit:
tilak is not asking how we can force are code to implement remote interface.


Its a advice just in case he wants to guarantee this behavior (though he has not asked for ).Most of the time you will find that EJB stubs are generated programatically and usually have a common service interface defining only the business methods.

Originally posted by Sunil Dixit:
But I think you forgot one thing in your explanation which it is not practically possible if your bean has local and remote interface.


I guess that according to EJB specification , the clients should not talk to the bean directly.A major reason to have a bodyguard , the EJBObject.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jetendra Ivaturi:

Along with, Our aim is not to trouble the bean. Meaning we are not supposed to acess the bean directly. That is the reason we have EJBObject.

So what ever the business methods we have we try to access thru EJBObject.

I mean to say it acts as an interface between the client and bean.

If Bean extend the Remote Interface, It becomes normal RMI application.


I could not get as how are you differing from what I said.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!