• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 675
  • Last Modified:

use JB3 or Spring for a 3 tier application ?

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?
3 Solutions
Mayank SAssociate Director - Product EngineeringCommented:
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)
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.
Mayank SAssociate Director - Product EngineeringCommented:
>> for the presentation tier, a framework like JavaServer Faces is a good choice.

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
kevorkgtAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now