File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Home Interface Return Type

 
Anurag Mishra
Ranch Hand
Posts: 121
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i have a doubt when we write a Home Interface we call a create() method
whic returns an EJBObject.
But return type of create() is RemoteInterface WHY??
as in below example which is a HomeInterface why return type is RemoteInterface
 
vikasids sharma
Ranch Hand
Posts: 157
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well because your created EJBObject is implementation of Remote interface
Originally posted by Anurag M:
Hi,
i have a doubt when we write a Home Interface we call a create() method
whic returns an EJBObject.
But return type of create() is RemoteInterface WHY??
as in below example which is a HomeInterface why return type is RemoteInterface
 
Anurag Mishra
Ranch Hand
Posts: 121
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can u pls tell me in Detail so that i can Understand..
thanks in advance.....
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Anurag M",
I'm sorry that I missed it in the previous thread but your display name still doesn't comply. The naming policy allows initials only for first name, not last name. We'd really appreciate it if you could change it (again).
Thanks, and sorry for the hassle.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anurag, the bean implementation class that the EJB container generates based on the implementation class you wrote implements the remote interface you wrote. The client is only interested in having access to an object providing that "business" interface, he's not interested in having an EJBObject. That's why the home interface's create methods' signatures return the remote interface.
 
vikasids sharma
Ranch Hand
Posts: 157
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lasse
Can we say other way..
As the Implementation class for EJBObject is generated by Container glue tools automatically .Client is concerned with the Interface(Remote) only that he has created as its implemetation is vendor specific. That's why the home interface's create methods' signatures return the remote interface
Originally posted by Lasse Koskela:
Anurag, the bean implementation class that the EJB container generates based on the implementation class you wrote implements the remote interface you wrote. The client is only interested in having access to an object providing that "business" interface, he's not interested in having an EJBObject. That's why the home interface's create methods' signatures return the remote interface.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Or even more compact: "The client is interested in the interface, not the implementation."
 
Anurag Mishra
Ranch Hand
Posts: 121
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot vikasids and Lasse for ur message.
i understood the point.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Anurag",
Sorry to pester you, but your display name is still not valid and this is one of few rules we are strict about.
Your display name must be two words, your first name, a space, then your last name. It should be your real name.
Check the Naming Policy page if you need more information.
thanks,
Dave.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic