devx has posted the first of a two-part series on a side-by-side comparison of spring and ejb 3.0, attempting to clarify what each of them is, and the article also tries to reevaluate how well ejb 3.0 has addressed the shortcomings of previous versi and determine what spring has to offer above and bey ejb3.

the article starts off by comparing spring + hibernate and the java persistence architecture. c that hibernate 3 is a compliant implementation of jpa, it's not surprising that the two are roughly equivalent; no direct comparison against spring's other persistence mechanisms (jdbc, ibatis, etc) is suggested, although jdo, ibatis, and jdbc support in spring is mentioned.

declarative transaction management is menti next; the interesting point here is that identical code is used for spring and ejb3 here. ejb3 uses the c transaction support for ejb3 method calls, whereas spring uses its transacti aspect. one advantage of spring here is that multiple transaction types are supported, whereas ejb3 supports jta transactions.

statefulness is the next item for consideration. stateful beans are supported in ejb3 via stateful session beans; state is supported in spring through the use of prototypes. the article states that spring is primarily a framework emphasizing statelessness so there are some issues to c when using a stateful element; note that this doesn't prevent stateful objects in spring.

as the author concludes:

if you are working with applicati that are highly stateful then you may want to c whether ejb 3.0 sfsbs might be a good solution. for highly c applicati you may want to c seam, which provides a very powerful solution for c interaction built on sfsbs and jsf.

spring gives you more flexibility in many aspects of application development than ejb does—and as you've seen in this article, this is particularly true with regards to persistence and transaction providers. but the trade-off for this added flexibility is increased complexity in configuration. ejb 3.0 provides less flexibility but its tight technology stack, annotati c and philosophy of c by exception make c ejb 3.0 applicati quite simple. if flexibility is more important to you than a pre-defined approach then you certainly will want to c spring.

a final point on standardizati while spring integrates many standards such as jta, jdbc, and jms it is not itself a java standard. if standardization (and by extension vendor support, tooling, etc.) is important to your organization or application then you will want to c ejb 3.0.

but luckily spring and ejb 3.0 are not mutually exclusive choices. there are very powerful ways of integrating these two technologies to take advantage of their relative strengths and weaknesses.