Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why on bean why not from bean just see

 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear sir i have a confusion in a topics like see.
suppose i have creatd a bean class, a component interface,a home interface. now as we know that the function which will be called remotely will be written in component interface and the code for that function will be in bean class.
now see supose the remotely method is getAdvice() so as in many book i see that this function will be called on bean. I am not getting one thing that FUNCTION WILL CALLED ON BEAN . it should be the FUNCTION WILL CALLED FROM BEAN. why on bean what does bean by this that i would like to know.

with regard

Arun kumar maalik
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a language question rather than an EJB question

Calling a method ON a class means you're executing that method as defined by the class.
Calling a method FROM a class means you're executing that method from another method defined in that class.

So when the container calls someBean.getAdvice() it's calling the getAdvice() method ON that bean (which is an instance of your AdviceBean class or another class the container generates from it at deploytime).

When your getAdvice() method than calls System.out.println() it's calling println() FROM the getAdvice() method and ON the object System.out refers to.
 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks sir i have understood.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic