Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The future of EJB 3 and Spring

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chris !
I still remember those days when I was hearing the words : Spring, Hibernate and the puzzle :
IoC.
When I was hearing IoC, I was saying : What the hell is this ?
What is Spring, is it dangerous ?
Well, all these ideas disappeard last month when I decided to learn them and they shifted me to
a new whole world.
They are easy, powerfull and sexy ! and I can hardly wait EJB 3.
And here, my question live.
We all know by now that EJB 3 programming will be POJO programming (and all other cool features that EJB got them from Hibernate&Spring like annotaions, testing without a container ...).
Where do you see Spring and Hibernate after the releasing of EJB 3 ?
EJB still has its own tough cards in the game (Security, concurrency, distributed objects, Open Source Vendors like JBoss and Apache).
Thanks.
 
Chris Richardson
author
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,

I posted a brief answer on EJB3 versus Spring/Hibernate on this thread: http://www.coderanch.com/t/216038/ORM/java/EJB

EJB3 is definitely a huge improvement of EJB2. So much so that I would readily use it. However, once you dive into the details you will encounter various issues:

* Spring's dependency injection is a lot more powerful and flexible, e.g. inject POJOs into POJOs, create objects via factory methods etc. In comparison, JEE dependency injection is limited to injecting JNDI objects into a fixed set of objects (EJBs, Web tier components such as servlets etc)

* EJB3/JPA object/relational mapping is less flexible than Hibernate or JDO's. e.g. lack of support for collections of non-entity beans; only limited support for preserving the ordering of lists.

* Session beans still need to be deployed in order to test them. EJB microcontainers do help with this though. In comparison, Spring beans are testable without any kind of deployment.

I write about these and other issues in chapters 1 and 10. The example code the book also includes some EJB 3 examples.

In summary. I think that Spring (and Hibernate) has a very bright future among developers who are not tied to using standards.

Chris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic