Solved

In JEE, when to use Spring and when EJB 3 ?

Posted on 2014-03-04
4
209 Views
Last Modified: 2015-03-02
In common JEE projects in which specific scenario using Spring would be better and when using EJB3 is advantageous ?
Based on what considerations one can decide either to use EJB3 or Spring

Regards,
Ayan
0
Comment
Question by:mrayandutta
4 Comments
 
LVL 27

Assisted Solution

by:dpearson
dpearson earned 150 total points
ID: 39905624
I may be wrong, but I don't know anyone still using EJBs today.  In the community I'm part of that's generally viewed as a failed technological path.  In part that's because EJBs seem to usually be coupled with JPA/Hibernate, which is also a bit of technological has-been these days.

So if your choice is EJB3 or Spring, I'd go with Spring.

Doug
0
 

Author Comment

by:mrayandutta
ID: 39905646
Hi ,
Thanks for your reply .
You mentioned that  EJBs seem to usually be coupled with JPA/Hibernate nowadays .
I think you are talking about Entity beans in this case .
But apart from that Session beans are also there .
Are they not used any further nowaday ?
I have mainly used Spring in recent years and Stateless session beans in some projects few  years back and for persistance I have mainly used hibernate (not Entity beans).
As a result as I have not worked in EJBs extensively  I do not know the full advantages/disadvantages of it with the latest releases .

As per you ,the trend is to go with Spring .What I want exactly want to when some one is making a decision to choose between EJB3 and Spring, what are aspects to consider ,where Spring is better and how .
0
 
LVL 27

Assisted Solution

by:mrcoffee365
mrcoffee365 earned 100 total points
ID: 39907706
Spring is an implementation of EJBs, and specifically uses Hibernate, which has  limitations if you are going to write a dynamic system making use of a large, complex database.  Also, if you expect to have a very high-traffic site making use of dynamic info in the db, then Hibernate is not your friend.

If you don't have a lot of in-house programming talent, and if your application is expected to stay fairly conventional in its database use, then Spring can help  as a framework.  It's a lot of work to set up, is somewhat counter-intuitive, but once you train your staff, it's no worse as a development environment than EJBs.
0
 

Accepted Solution

by:
manchandap earned 250 total points
ID: 40151453
An interesting comparison can be found here: http://www.visionsdeveloper.com/blog/page/ejb3-vs-spring-framework.jsp

Spring Framework consists of many modules like DI, Spring DAO, Spring JDBC, Spring MVC, Spring MVC etc. Also, it's very easy (and fairly common) to integrate Spring with ORM tools like Hibernate.

One key advantage of Spring is that an application written using Spring doesn't requires any special container to run. Spring provides it's own container. So, a spring app can run on its own as well as in a servlet container like Tomcat.
Since EJBs are written as per Specs, they need specialized containers like JBoss, Weblogic, Websphere etc to run.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 123
sql import cannot be resolved jsp 3 72
JAVA API design with micro service cloud in mind 1 75
Java Eclipse Loop 3 28
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 second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

685 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