1 Reply Latest reply on Oct 26, 2005 6:50 AM by Gavin King

    some comments on seam

    Patrick Angeles Novice

      I have to qualify that I'm new to EJB and JSF (and still a bit green with Hibernate), but have had my fair share of experience with developing J2EE web-apps using combinations of JSP/Velocity/Struts/Spring/JDBC (ugh)/Hibernate.

      I've been looking at the Hibernate/EJB3/Seam/JSF stack to refactor an existing web platform. I've had to rely heavily on the JBoss/Hibernate Wikis and discussion forums, as there are no current books out there (I have to say that JSF online documentation is particularly crappy).

      After about 3 weeks diving into Seam, here are my initial impressions:

      - Seam could do well from more documentation, sample code and perhaps a Wiki with documented best practices.

      - The hardest part of picking up this "stack" is knowing where one layer ends and another one begins, particular wrt to the "glue" functions. Hibernate is clearly responsible for persistence, and JSF for MVC. Seam and EJB3 overlap in terms of the "glue" layer in that both provide IoC, lookup and transaction management, but sometimes its confusing to figure out which is doing what...

      - Too many annotations get confusing. There's @Create/@PostConstruct, @Destroy/@Remove, @In/@Inject, @Valid/@IfInvalid, @Name/@EJB/@Jndi, @Intercept/@Interceptor, etcetera, etcetera... Don't get me wrong... I think annotations are great when objects have a well-defined role in a single layer. HB/EJB3 persistence layer annotations come to mind. However, I think it might be good practice to use fully qualified annotations (e.g., @javax.ejb.PostConstruct) when mixing annotations from different layers/APIs. At least on sample code.

      - Better yet, it would be much easier to work with one set of annotations that act as an umbrella for the various Seam/Persistence/EJB/Validation annotations.

      - I think Seam's flexibility in allowing a developer to work both with POJOs and EJBs is both a blessing and a curse. In the end, I think it's better to force one way of doing things just to flatten the learning curve. But then again, this is probably something that good documentation can resolve.

      - Smart code-generation from annotated EntityBean to JSF fragment is essential. I know there are efforts underway in the Hibernate Tools subproject.

      Overall, I appreciate the power of Seam. I especially like the conversation context and the transaction management. Seam needs some refinement, but I think the developers are onto something.

        • 1. Re: some comments on seam
          Gavin King Master

          # Right, we are working on it, especially on the examples side of things. This is brand new stuff, and building docs and examples always takes waaaay longer than building the actual code.

          # Right, its something you need to define your own project standards for. My best advice at this stage is: let Seam do injection and tx management, and if you run into a case that requires a more complex model than what Seam can handle, drop down to native EJB3.

          # My IDE gives my the fully qualified name and Javadoc when I hover over the annotation.

          # I think the beauty of the annotations model is its extensibility. A package of annotations can solve an "aspect". So I strongly disagree on this point.

          # Right, this is a central part of our vision for this stuff, and we are working on it.