• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

private or public EJB method

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anybody know what the difference is between having a private method in an EJB and a public method which is not exposed on component interface ie not visible to clients. I'm using such methods as helper methods.;

Is there any difference between the 2 and if not which one is good practice?

Thanks
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The client can access only those methods, that are exposed through the Component interface or Home interface. So if you are not exposing a business method in the component interface then it will become a helper method. Or only those methods that are exposed through the component interface are considered as business methods.

Normally helper methods which are implemented by the bean is decalred as private. I think that is the best practice too. Then even if your are writing helper methods are public and not exposing the same in the component interface, then the client can't access it. So it does't mean a lot, but still it is legal.
 
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your helper methods are declared in a interface and your bean implements the interface then your helper methods are public. However if you define your methods in bean class then your helper methods are private though you can still declare the helper methods in your bean class as public and it would not do any harm as long as you have not exposed the same in your component interface as pointed out in the previous posting.
[ April 15, 2005: Message edited by: Ravindra Janapareddy ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic