Spring Vs EJB ( A feature comparison)

By Emiley J. Viewed: 31779 times Emailed: 177 times Printed: 233 times Bookmark and Share



In quite a few design brainstorming sessions, the debate between Spring and EJB results in a deadlock. There are developers who are damn passionate about Spring and hate EJBs. Let’s have a look at the main important differences between the two in terms of features they support.

 

 

 

 

 

 

 

 


 

Feature

EJB

Spring

Transaction management

  • Must use a JTA transaction manager.
  • Supports transactions that span remote method calls.
  • Supports multiple transaction environments through its PlatformTransactionManager interface, including JTA, Hibernate, JDO, and JDBC.
  • Does not natively support distributed transactions—it must be used with a JTA transaction manager.

Declarative transaction support

  • Can define transactions declaratively through the deployment descriptor.
  • Can define transaction behavior per method or per class by using the wildcard character *.
  • Cannot declaratively define rollback behavior—this must be done programmatically.
  • Can define transactions declaratively through the Spring configuration file or through class metadata.
  • Can define which methods to apply transaction behavior explicitly or by using regular expressions.
  • Can declaratively define rollback behavior per method and per exception type.

Persistence

Supports programmatic bean-managed persistence and declarative container managed persistence.

Provides a framework for integrating with several persistence technologies, including JDBC, Hibernate, JDO, and iBATIS.

Declarative security

  • Supports declarative security through users and roles. The management and implementation of users and roles is container specific.
  • Declarative security is configured in the deployment descriptor.
  • No security implementation out-of-the box.
  • Acegi, an open source security framework built on top of Spring, provides declarative security through the Spring configuration file or class metadata.

Distributed computing

Provides container-managed remote method calls.

Provides proxying for remote calls via RMI, JAX-RPC, and web services.




Comments(2)


1. Thanks for this nice comparision table for Spring Vs EJB.

By: guddu at 2009-10-17 03:08:59
2. It seems author has half knowlage
EJB main Feture is Distributed Computing (as you can say extension of RMI/Corba) ,
Transaction managment etc is there secondary feture

By: Aryan Siddharth Singh Gautam at 2010-03-22 03:40:11

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:


Enter Code:
The Captcha image

Latest Tutorials

[2008-11-24]Creating a JavaBean to Connect with Google API
[2008-08-15]Spring Vs EJB ( A feature comparison)
[2008-08-13]What is EJB server and what are EJB Components?
[2007-10-12]JavaBeans Basic Concepts
[2007-10-06]JavaBeans vs. Custom Tags
[2007-09-23]Java Beans and the Expression Language
[2007-09-23]A sample that shows Java Beans, Servlets and JSP working together
[2007-09-15]Advantages of Java Beans
[2007-09-15]Design Patterns for Properties in a Java Bean
[2007-07-12]javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[2007-02-20]ADVANTAGES OF EJB
[2007-02-20]Steps to develop EJB Environment
[2007-02-20]EJB is a server side component:
[2007-02-20]Entity Bean
[2007-02-20]History Of Java

More Latest News

Most Viewed Articles (in last 30 days)
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
A sample that shows Java Beans, Servlets and JSP working together
Advantages of Java Beans
Spring Vs EJB ( A feature comparison)
What is EJB server and what are EJB Components?
JavaBeans Basic Concepts
Reusable component
JavaBeans vs. Custom Tags
ADVANTAGES OF EJB
Creating a JavaBean to Connect with Google API
Design Patterns for Properties in a Java Bean
Java Beans and the Expression Language
EJB is a server side component:
History Of Java
Entity Bean
Most Emailed Articles (in last 30 days)
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
History Of Java
Advantages of Java Beans
Reusable component
EJB is a server side component:
Entity Bean
Steps to develop EJB Environment
ADVANTAGES OF EJB
JavaBeans vs. Custom Tags
Java Beans and the Expression Language
JavaBeans Basic Concepts
A sample that shows Java Beans, Servlets and JSP working together
Design Patterns for Properties in a Java Bean
Creating a JavaBean to Connect with Google API
What is EJB server and what are EJB Components?