use JB3 or Spring for a 3 tier application ?

Posted on 2007-04-05
Last Modified: 2013-11-24
I’m new to EJB3 and Spring technologies.  I have been reading about their difference and it seems that EJB3 solve the problems from its predecessors.  Spring solve many of problems from EJB1 and EJB2 as well.  

I’m going to develop a 3-tier application, I will have server and different clients (phones, pda, standalones, browsers, etc) are going to connect to it to retrieve data and process business logic.  Which technology should I use and what are the pros and cons of using one over the other?
Question by:kevorkgt
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 100 total points
ID: 18861248
I would vote for EJB 3 because it is a Java EE standard with a specification. Spring is not yet a standard - it is just a framework available for use. EJBs are heavier but you can do a lot more with them (e.g., MDBs)

Accepted Solution

mhunts earned 200 total points
ID: 18868623
If it's a choice of EJB OR Spring, I'd say EJB3. However, a hybrid approach is better. Use EJB3 stateless session beans for middle tier. Use MDB if you need messaging. Entity beans with hibernate persistence are a good choice available with EJB3. For the presentation tier, a framework like JavaServer Faces is a good choice. It's based on JSPs, but it offers the model-view-controller framework which helps a lot with the plumbing.
LVL 30

Expert Comment

by:Mayank S
ID: 18874444
>> for the presentation tier, a framework like JavaServer Faces is a good choice.

LVL 10

Assisted Solution

mbvvsatish earned 200 total points
ID: 18881232
It is dependent on the kind of environment that the application is going to run and its future plans like distributed deployment, clustering envronment, number of concurrent users, performance level so on and so forth...

I recomend you to go through the books "Expert one on one - J2ee development - by Rod Jhonson" and "Expert one-on-one j2ee development without EJB - by Rod Johnson".
Very nice explanation has been given by the author on where to use EJB, where you should not use EJB, When do you go for spring and so on.

The books will really be very useful when you design the architectures for the projects and give you very good idea on the 2 technologies

Author Comment

ID: 18883964
Thank you all for your replies.

mbvvsatish, the two books you recommended were published before EJB3 specifications were released. In addition, a lot of disadvantages of using EJB that the "Expert one-on-one j2ee development without EJB" mentions are addressed, according to what I've read so far, by the new EJB specifications.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
matchUp  challenge 9 94
Unable to open debugger port in Intellij idea 6 143
eclipse package explorer vs project explorer view 2 80
eclipse with Angularjs2.0 3 16
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now