Thursday, January 21, 2010

A few things I like (and don't like) about EJB3

What I like (and don't like) about EJB3 and recent IDEs

It's been a long time since I worked with JEE, so I've recently been working with late-model application servers from Sun and Jboss. (I wanted to work with both at the same time to see which toolset I really liked best, and to help me better understand things.) This week I've been working with EJBs and I'm delighted to report EJB3 really does fulfill the promise of greatly simplified development. After a few hour's practice, I am now confident I could crank out a Session bean from scratch in less then 5 minutes on either JBoss or NetBeans. (In the old days, this never would have been possible.)

Here are a few of the things I liked and disliked about my re-acquittance with EJBs.


What I like:
1. Plain annotated POJOs in a .jar -- no XML, and it really does work.
2. NetBean's 'Insert Code'/'Call Enterprise Bean' wizard. Client code made simple!
3. The excellent online tutorial here
4. Using JBoss Tools, I really like the 'Archive Manager' view. It gives you a great UI to make a .jar, .war, .ear, whatever you need. With no scripting!
5. The JBoss Tools 'Server' view. Easy, in-Eclipse way to start/stop the Application Server
6. Ditto for NetBeans and the GlassFish controls. (Extra credit to NetBeans for Database control in the IDE, too.)

What I didn't like:
1. NetBeans generating a bunch of stuff behind my back. (Of course you can use jar -tvf to see what it is, but I'd rather see it up front where I can easily understand it.)
2. JBoss and the never-ending story of how you really write EJB3 beans. They now have a bi-monthly plug-in you have to apply to keep your app server up to date! If you Google for a JBoss EJB3 tutorial, guess what you'll find? 17,000 blogs that tell you the way that guy did it, most of which won't work for you. (At least that was my experience.)
3. Writing a JBoss client that needs a properties file or in-line setting of necessary properties. In the old days that was fine, but NetBeans has raised the bar on that one. (Counterpoint: I guess I have to use the default ports, etc. for the NetBeans auto-magic client to work. Fine with me, for today at least. BTW, I recognize this is inconsistent with Gripe #1.)

If you've never written an EJB, or haven't written one lately, I'd really encourage you to have a look. (If you're really new to it, I'd suggest the NetBeans/GlassFish route, I think it's a little easier.) If this is the future direction of Enterprise Java, I am encouraged.

Next up: JPA persistence. Let's see how that one goes!

'Till then, Happy Coding!

2 comments:

EvgeniyK said...

Good points, Rick, thanks. Amateur point of view, thus useful.

Alexis MP said...

Make sure you check out EJB 3.1 too. http://blogs.sun.com/glassfishpodcast/entry/episode_043_ejb_3_1