breddy.net


Seam, EJB3 and Gavin

Posted in Java by chris on June 13th, 2006

This afternoon’s festivities were highlited by a characteristically colorful presentation by Gavin King. For those who don’t know, Gavin is the creator of the Hibernate persistence framework which was aquired eventually by JBoss.

Gavin & crew demonstrated quickly but effectively the lovely synergy that has been brought to EJB3 and JSF by their newest creation, Seam. Seam can hardly be called a web framework — you wouldn’t recognize it as such what with its lack of, well, just about everything that you’ve come to expect from a web framework.

Seam throws away boilerplate code a-la Rails, but does so in a way that leverages a lot of the untapped power of EJB3 and JSF. Seam is all about Don’t Repeat Yourself (DRY). As such, we throw away form beans (a-la Spring MVC) and a whole lot of XML (in favor of annotations).

The most surprising theme that emerges from all of this is the rampant use of Stateful Session beans. You read that right - I said Stateful. Seam begs the question, “why on earth would I represent state in a database (slow is an understatement) or in HTTPSession (with no dirty checking) when I can use this lovely gift called Stateful beans?” He makes a damn good point. By representing web conversations as SFSB’s (which are POJO’s in EJB3, in case you’re wondering) you eliminate many of the headaches associated with web apps. Multiple tabs open in your browser? Piece of cake - each browser tab/session/window has a unique conversation (they’re stateful, remember?). Double submit? Ha! Don’t even try! Want to have a clean client redirect after performing some action, but still pass messages across? No problemo - you’ve got a lightweight stateful conversation behind you.

By logically grouping your flows into SFSB’s, you can leverage more sophisticated failover because the container dirty-checks each instance and replicates automatically. Try that with HTTPSession.

So, I will be doing a sandbox app soon with Seam, and I’ll post more as I know it. Till then, read all you can.

2 Responses to 'Seam, EJB3 and Gavin'

Subscribe to comments with RSS or TrackBack to 'Seam, EJB3 and Gavin'.

  1. Squashua said,

    on June 15th, 2006 at 4:23 pm

    So… is Seam the Java answer to RoR? Please?

  2. chris said,

    on June 16th, 2006 at 11:38 am

    You might say that, although I don’t see any RoR folks defecting to become Seam cheerleaders just because it’s potentially cleaner than other Java web frameworks. It does go a long way to eliminating some of the redundancy though, and it also includes quite a lot of support for DWR-style remoting using AJAX.

Leave a Reply