Thursday, 21 April 2016

EJB vs. Spring


Transaction management
EJB
  • must use a JTA transaction manager.
  • supports transactions that span remote method calls.
Spring
  • 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
EJB
  • 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.
Spring
  • 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
EJB
  • supports programmatic bean-managed persistence and declarative container managed persistence.
Spring
  • provides a framework for integrating with several persistence technologies, including JDBC, Hibernate, JDO, and iBATIS.

Declarative security
EJB
  • 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.
Spring
  • 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
EJB
  • provides container-managed remote method calls.
Spring
  • provides proxying for remote calls via RMI, JAX-RPC, and web services.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.