Want an introduction to Seam?

Posted by    |      

Well, you're in luck!

I spoke at JBoss User Group in Denmark in late August, and they recorded both the Seam introductory talk I did:

[ Part 1 | Part 2 | Part 3 | Slides ]

and the Web Beans introductory talk:

[ Part 1 | Part 2 | Part 3 | Slides ]

And, if that isn't enough, you can watch a recording of the recent Introduction to Seam 2 webinar we recorded.

I didn't get a chance to address all the questions asked in the webinar as we ran out of time. So, here are all the questions asked, with answers. Before we start, many thanks to Dan Allen, Dan Hinojosa, Daniel Roth and Jay Balunas for helping me out with the answers :-)

Getting started

  • If I don't use Seam framework, which patterns should I use? I mean, what are the good practices for developing with Seam? Can we use DAOs, Mediators or something else? This is a big question - one we don't have time address here. In general, Seam allows you to design your app around your use cases, rather than artificially imposed patterns. There are quite a few good books out there on Seam - buy one :-)
  • Seam framework is a start point for new projects or can I use it together for new entities in an old project that is already in production? I wouldn't say it's a great idea to do this. If you want to use Seam, you'd probably merge your webapp into Seam, not the other way around.

Conversations

  • Can an atomic conversation span several sessions? I.e. the user can start a conversation in one session, postpond it, log in and continue? Can a conversation/process be continued by another user than the one initiated it or will the answer to these questions to be jBPM? As you say, a jBPM process is the way to have a conversation that lasts for longer than a session that can by multiple people. A conversation would typically be a task within the jBPM process.
  • So, when I do not specify flushMode=manual everything will be flushed automatically at conversation end? By default JPA flushes the persistence context at method boundaries. Manual flush mode means the persistence context will only be flushed when you call entityManager.flush().
  • I do not understand why a conversation can be longer than a transaction? For me the transaction is bound to a unit of work (like the conversation)... Don't forget that a transaction has a general meaning in english, and specific meaning. An atomic conversation represents a users transaction with the application, and can span multiple screens. What is being transacted is the persistence context, not the database. A system transaction (a database transaction) cannot be this long for a number of reasons - for example, the application wouldn't scale as you would hold read-write locks on the database tables for a long time. Thus, the idea is to flush the persistence context all at once, at the end of the use case, rather than in stages along the way that would lead to inconsistencies in the database.
  • How would you compare the conversation in seam to Spring web flow and the way they implement conversations there? My understanding of Spring webflow is that it is closer to Seam's pageflows (which defines a state graph for naviagtion), rather than Seam's conversation model (which uses ad-hoc navigations). But I'm no expert on Spring webflow.
  • Does Seam support anything like Spring Web Flow to define Webpage navigation? Yes, read about pageflow.

Components & Contexts

  • What is bijection? Injection = container initializes bean fields with contextual Stateful variables (from the contexts - cloud of variables) just before they are needed. Outjection = container copies the stateful variable back to the contexts. Bijection = Injection + outjection. This makes it safe for multiple stateful components with different lifecycles to temparaly hold references to other stateful components. Read more
  • Where and how does EJB 3 come in place with seam If you want to use EJB3 with Seam, then Seam will happily manage your EJBs for you, providing the full benefits of the Seam component model. If you don't want to use EJB3, then you don't have to; so why use EJB3? Well you might want to use some of it's ore enterprisy features like MDBs.

IDEs and Tools

  • What is the state of Maven-based Seam development? Are there related plugins/archetypes? Seam publishes Maven poms which contain a transitive dependency tree for Seam. There aren't any archetypes yet, though there are plans afoot.
  • What operating systems is JBoss Studio available for? Linux, Mac and Windows
  • Does the Jboss Tools project, have all the features that are present in jboss developer studio? Yes, Jboss Tools has most of the tooling features that are as part of JBDS. I would say JBDS is more of a superset that includes JBoss Tools integrated with Eclipse, integrated runtime EAP (Enterprise Application Platform), + Spring IDE
  • Are there any tutorials to transform an old seam projects into to a jboss tools seam project? No, your best bet is to create a new project in JBDS, and then copy in your code and configuration files.
  • Is there a NetBeans plugin available that provides Seam support (like the Eclipse-based IDE)? Mostly yes. Whenever you create a seam project using seam-gen an nbproject folder is created for you and you can open your seam project in NetBeans. The reason that the answer is mostly is because NetBeans doesn't offer as many plugins as Eclipse or the upcoming IntelliJ for Seam. Groovy support for NetBeans is also still being developed for NetBeans so you may have some unpleasentness for a short while. Michael blogged about this a while ago.
  • I tried setting up seam in netbeans 6.0. The seam-gen plugin doesn't work. Why is it so? Here's the error generated. C:\jboss-seam\jboss-seam-2.0.2.SP1\seam-gen\build.xml:607: C:\modules\ext not found. You'll need to ask on the NetBeans forums about NetBeans support for Seam. Keep in mind that the seam-gen plugin for NetBeans was really designed for an older version of Seam and is currently being redesigned.
  • Are there any built in debugging tools to inspect the entities, what all is this tool capable of? Out of the box, Seam has a debug page that allows you to not only inspect your entities and the scope that they are in, you can view your POJO and EJB3 Action Beans, view their references and values and view any applicable stack traces. You just have to make sure you deploy in a dev profile and go to /debug.seam (or whatever your custom extension) is.

View layers

  • I noticed Seam 2.10 beta has provided first-class support for Wicket. Are there any plans to do the same with GWT? The provided example with remoting/GWT is not as extensive as the one for Wicket and I'm looking for better integration between the two. Yes, keep your eyes open for more GWT support over the next few months :-)
  • Is it possible to mix Wicket and JSF view layer in one project? Probably not, but I haven't tried. If you isolate the view mappings, it might work. Have a go, let us know how you get on at the forums.
  • I'm quite familiar with GWT. I read bout the RPC integration. However, how to use the other Seam more useful features such as scopes, validators, etc with GWT together? Currently the GWT support uses Seam remoting to interact - this allows you to access the Seam contexts as normal, but there is no Hibernate Validator support. Keep an eye out over the next few months for more on GWT.
  • Do you cooperate with ICEfaces to improve the integration of ICEfaces since I noticed that many JIRA for ICEfaces stay unfixed for a long time. Yes. Judy from the ICEfaces team maintains the Seam-ICEfaces integration in Seam (both in seam-gen and the icefaces example) - the open issues in the Seam JIRA can probably be closed off as out of date, as they originate from the pre-Judy days ;-) Currently, ICEfaces is rewriting many of the seam-gen templates to take better advantage of the partial page rendering in ICEfaces.

Testing

  • What about testing of seam applications? Selenium, JMeter, JSFUnit, other Seam works great with unit tests as everything is POJOs, and provides a testing framework for doing integration tests with a mock JSF lifecycle. We're currently adding JSFUnit and Selenium tests to our examples - both work great with Seam.

Application Server interoperability

  • Does Seam run with Oracle's OC4J? Yes, Seam runs on OC4J 11 and there are community reports of it working with OC4J 10.
  • Is it possible to use toplink instead of hibernate when using JBoss seam? What about OpenEJB? The biggest roadblock to using TopLink comfortably is that it does not support manual flushing of the persistence context like Hibernate. So it is more of an architectural limitation. You can currently use Seam with OC4J11.4g See Section 33.3 of the user guide for more information of using OC4J . As per OpenEJB, there has been experimentation done by Seam users around the world. The best bet is inquire a search engine to view some of the work that they have been doing or try it yourself. If you do try it yourself, please report to us so that we can spread the word about sing praises of your name.

Security

  • Why seam asks twice for authentication? This is discussed in the documentation.
  • Will Seam 2.1 provide easy support for SSO (Single-Sign-On) using products where the JAAS context (Subject, Principals) is already available when the application starts? Work on SSO is currently underway. We decided to get Seam 2.1.0 out there asap, rather than wait for it do be done, so Seam 2.1.2 will support SSO.

The future

  • What are your thoughts on EJB3.1 lite and its interactions with Web beans? EJB 3.1 brings a number of exciting developments, among them a much simpler deployment model - being able to deploy EJBs in your WAR. WB will integrate with EJB 3.1 lite just as it does with normal EJB containers (assuming it is also executed in a web beans container. EJB 3.1 lite and Web Beans should be a good match.
  • What is the long term for Seam when Web Beans is out? Is there that much of a difference that the two will proceed together or will Seam become maintenance only and all new features will be in Web Beans. We anticipated this FAQ ;-)
  • Will both models be supported in Seam 3? The type safety and the string based approach? Seam 3 will be have WB as its core. WB is a type safe component model and framework. If there is a large community pressure to support the classic, Seam 2, core we will look into it (we anticipate pressure here from developers that prefer dynamic languages). This issue is Seam 3 (rather than Web Beans) specific.
  • When will you start developing seam based upon web beans (i.e. version 3), will 2.1 be the last major version before 3? The current plan is to release Seam 2.1.0 then quickly follow up with Seam 2.1.1 and 2.1.2. After that work will begin on Seam 3 - think early Spring. As always, plans may change ;-)
  • I am starting a new seam project that will release into production within 3 months. Can I safely start with Seam 2.1 with confidence that the beta cycle will be complete by year's end? yes ;-) The Seam 2.1.0.GA release will be available in the next month or so. There will be follow on releases that focus on specific improvements 2.1.1 (increased performance) and 2.1.2 (SSO support). These should be drop in replacements for 2.1.0.

Other

  • I can see that message in the Validation example is hardcoded. How do you I18N this example? You can easily internationalize the message - just use the Seam message bundle @Length(min=3, max=1000, message="#{messages['validate.length'}") String description;
  • Does Seam provide an easy way to handle web session timeouts? I have had to create a solution for checking on the session and redirecting users to the start page when session times out. I'd like to use Seam to handle web session timeout instead of creating my own solution... Take a look at Christan's solution. Also you can observe the org.jboss.seam.preDestroyContext.Session event.
  • What are the more significant changes or enhancements between Sean 1.x and 2? Take a look at Norman's announcement
  • Is the hot deploy feature specific to JBoss AS or Seam ? The hot deployment of action components is a feature that is specifically handled by Seam and available in exploded WAR deployments. Don't confuse it with the hot deployment of the application itself, which falls in the realm of the application server. To enable hot deployment of components, Seam uses a standard Java classloader type (URLClassLoader) to load certain components. When Seam detects a newer version of one of these component in the exploded WAR directory, the set of action components are dumped and rescanned. This feature falls under Seam's management of components (its contextual container).
  • Does the Seam Messaging Component support the creation of message topics on demand? Seam just provides an easy way to access JMS, so this depends on your underlying JMS provider.
  • What is the one major feature that makes seam 2.0 better than JSF or Visual JSF? There will always be varying opinions as to what that one feature is for them. For me it's not having to create a JSF Managed Bean that acts as dummy adapter that merely that fowards request to business-logic bean (EJB3 or POJO) and wasting a lot of development time.
  • Can you integrate Seam with an Action framework? There is no integration to Struts or Stripes nor do I think there would be since action frameworks don't focus on having a stateful component architecture. But, while JSF isn't an action based framework, Seam can act as an action framework - take a look Seam's page actions for more information . In fact, the more you use seam actions, the less you'd likely want to go back to the Action framework days.
  • Can we see an example of how Seam integrates with BPM and Rules? Take a look at the dvdstore example in the Seam download for BPM. Take a look at the drools example for the Drools integration.

Back to top