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.