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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSum6 challenge 6 95
HashMap Vs TreeMap 12 63
stackato and cloud 4 93
iterator/ListIterator approach 17 39
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
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…
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.

792 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