Solved

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

Posted on 2014-03-04
4
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 28

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

691 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