This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Why EJBs? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Why EJBs?" Watch "Why EJBs?" New topic
Author

Why EJBs?

Saeed Amer
Ranch Hand

Joined: Jan 20, 2004
Posts: 140
EJBs are getting ridiculously complex and one cannot master them just by reading books or taking exam or attempting certain examples. Even if one is working with EJBs at work, it takes months to get a certain level of comfort.

So why use EJBs? Why not use SQLJ, JDO or even simple plain JDBC?

Regards,
Saeed Amer
[ July 26, 2005: Message edited by: Saeed Amer ]
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
It is because EJB containers provide more functionalities than those technologies you had specified. For example, in case there is an exception involved a series of DB operations, if one of them has been failed, the whole transaction should be rollback. Then, you have to code for handling such events. For EJB, containers will cater all stuffs for you.

Although it is very complex, EJB 3.0 has tried to simplify EJB via POJO and make use of the idea of Hibernate. Let's see the improvement of the new EJB generation.

Nick


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Siripa Siangklom
Ranch Hand

Joined: Jan 26, 2004
Posts: 79
Hi Saeed,

You get infrastructure services such as transactions, pooling, security, and so on from EJB containers. You can focus on business functionality.

Thanks,
Siripa
Barend Garvelink
Ranch Hand

Joined: Dec 07, 2004
Posts: 64
I'd say the primary reason for using EJB is to get the distributed transactions. EJB is certainly not suitable for every situation (as is well-documented).


SCJP 1.4, SCJD 1.4, SCWCD 1.3, ICSD:Websphere 5.1
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
This could be interesting.
http://www.coderanch.com/t/316680/EJB-JEE/java/EJB-vs-Spring


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Joao Vitor Guimaraes
Greenhorn

Joined: Nov 02, 2002
Posts: 4
Originally posted by Barend Garvelink:
I'd say the primary reason for using EJB is to get the distributed transactions. EJB is certainly not suitable for every situation (as is well-documented).


For distributed transactions you have JTA and EJBs use it internally.

Spring provide some features, like declarative transaction through AOP that can use JTA too if you need.

As this thread is about "Why EJB's?" I'm mentioning Spring as a good alternative/complement that can be used in many projects.


Joao Vitor Lacerda Guimaraes<br />SCJP 1.4, SCJP 5.0<br />Belo Horizonte - Minas Gerais - Brazil
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
As this thread is about "Why EJB's?" I'm mentioning Spring as a good alternative/complement that can be used in many projects.

In certain sense, if any opensource framework looks good to J2EE, I guess SUN will try to adopt their features in the upcoming versions, like EJB 3.0 adopts the ideas from Hibernate.

So, don't worried too much, J2EE framework will be more and more mature.

Nick
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why EJBs?
 
Similar Threads
why two "rmi" packages?
SessionSynchronization interface and stateless session bean
Bean Timeout and @PreDestroy
i hope i can get some advice
how to get final number ?