ejb3

Quick Profile

Alex Ooi Profile Picture
Hometown: Melbourne, Australia
Specializations: Java, Ruby on Rails
University: Software Engineering & Economics, Melbourne University
High School: VCE, Melbourne High School
Links:
 

Popular Articles

Tuesday, February 22, 2011

Been re-visiting EJB-land after having done a fair bit of Spring/Hibernate lately. Especially focussing on EJB3 and JEE 5. A few things struck me as interesting:

  • EJB 1.1 and 2 suck. They really suck. With all that vendor-specific XML and boiler-plate code for creating Home classes it is no wonder all these new-fangled RoR evangelists have heaps of ammo when declaring Java as "dead"...

  • There is a strange feeling of deja vu when coding an app in EJB 3 vs coding using Spring Annotations. Both allow for declarative transaction demarcation with annotations. Both integrate well with JPA. Both enable easy dependency injection via more annotations.

  • JPA annotations are everywhere in the data persistence layer of both apps. Except one wonders why anyone would use JPA when Hibernate is basically the de-facto standard in the industry already. And there isn't yet a JPA equivalent of the Hibernate Criteria API which is a huge drawback when constructing complex queries... Sure, theres the age-old argument of decoupling your application code from a vendor specific technology. But Hibernate is just damn good. Also, it is just a JAR file that runs on any servlet container. It's hardly the same as those horrible vendor-specific CMP mapping files of EJB 1.1/2...

  • The Stripes framework provides a really nice way of injecting either Spring Beans or EJB Session Beans into the web tier. Actually, given how popular Spring is, and how new the Stripes MVC framework is, and how OLD EJB is, I was pleasantly surprised to see there was quite good support for the injection of EJB beans.

  • JBoss has an embedded Tomcat servlet container that it seems to delegate to for deployment of WARs. Or at least thats what appears to be happening on my installation. Need to investigate this further. Seeing tomcat logs in my jboss logs was truly bizarre...

Still more to come. I haven't worked with EJBs as much as Spring/Hibernate, so picking up a whole lot of new stuff as I go along. High on the priority list is testing of EJBs outside of a fully-fledged J2EE container. That will be interesting...

Regardless, it sure is nice to be doing some coding in a type-safe language, even if there is abit of extra verbosity (c'mon, is the lack of lambdas REALLY that big a drawback?!?!?!). There is soo much that my IDE can do for me in java-land that it just can't do in Rubyland. Code navigation, quick refactorings, flawless debugging, inlining, usage lookups, etc... Rubymine tries, but just falls flat on its face far too often for me to have any confidence in it. *sigh*

Comments ...

Holy Guacamole! Nobody has commented on this post yet! Why don't you make a name for yourself and be the first to do so ... Any comment whatsoever, as long as it is non-defamatory, will be welcome!

Add a Comment

*
*
You must answer the following simple maths question before your comment will be accepted.
*