File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Advantages of EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Advantages of EJB" Watch "Advantages of EJB" New topic

Advantages of EJB

san yee

Joined: Dec 21, 2006
Posts: 5
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

Joined: Nov 16, 2005
Posts: 502

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.

Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />
Neerav Narielwala
Ranch Hand

Joined: Dec 08, 2006
Posts: 106
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.

<a href="" target="_blank" rel="nofollow">Java Tutorials</a> | <a href="" target="_blank" rel="nofollow">Java Weblog</a> | <a href="" target="_blank" rel="nofollow">Computing Articles</a>
I agree. Here's the link:
subject: Advantages of EJB
It's not a secret anymore!