Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Advantages of EJB

 
san yee
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one please tell me ,what are the main advantages of using EJB's over servlets or other technologies

Thnaks in Adance.
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In multi tier J2EE application,


JSP/Servlet - used in web tier. This is used for user interaction.

EJB - used in Business Tier or EJB Tier. This is used to interact with sensitive data and to build business processes.
 
Neerav Narielwala
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main advantages to EJB:

1. Transactions
2. Method level security
3. Concurrency control

The container handles all of this for you. Items 1 and 2 can be specified with XML declarations. It's really nice not to have to worry about multi-threaded code, transaction demarcation, and method level security.

Portablity between containers is also a plus, though it is not so seamless as one would like. As a minimum, you have to recompile the beans with the target vendor's EJB compiler.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic