Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why call a local stateless bean?

 
Damodar Mukherjee
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know why call a local stateless bean instead of plain function call from the bean itself?

Is there any reason besides scalability?

Thanks
 
Scott Selikoff
author
Saloon Keeper
Posts: 4020
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scalability is big. Session beans also provide transaction management especially if they interact with a database.

The rule of thumb is that if a database or other persistence storage is involved, use a session bean since it gives you transactional control. If you're calling a static-like method for performing some mathematical calculation then you'd want to avoid the session bean and just a regular method call.

What it really comes down to is this: Is the method providing a service or a utility function?
[ August 19, 2008: Message edited by: Scott Selikoff ]
 
Damodar Mukherjee
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You... I agree with you, but what if I know my application will always stay in a single container? In this situation is using EJB session bean is worth?
 
Scott Selikoff
author
Saloon Keeper
Posts: 4020
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Damodar Mukherjee:
what if I know my application will always stay in a single container?


Then I'd say you are a lucky man. If you are the only programmer than you shouldn't be using EJBs in the first place. EJBs are really only if you have a medium size company with many programmers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic