4 Replies Latest reply on Aug 2, 2007 12:54 AM by Gavin King

    Some doubts about Seam

    Miguel Angel Goicochea Newbie

      Hello everyone,

      I have just come across JBoss Seam some days ago when I heard about it in an announcement regarding Red Hat Developer Studio and it caught my attention.

      I sill have some doubts about it:

      1.- How is persistence managed? Does it use EJB 3.0 persistence (I don't know much about EJB) or can I use hibernate? If it uses Hibernate how is it implemented? As usual with Hibernate or does it uses some kind of annotations for it?

      2.- Can I use tomahawk components with seam? On the tutorial I saw that the url filter is "*.seam" when tomahawk needs "/faces/".

      Thanks,

        • 1. Re: Some doubts about Seam
          None None Master

          To answer your questions:

          1. Seam works with either EJB3 or Hibernate. I'm using EJB3 in my projects because EJB3 is a standard. I think that Hibernate itself is a bit more powerful in what it can do. Under the hood, JBoss EJB3 is based on Hibernate I believe.

          2. Don't use Tomahawk. I tried that. It was extremely frustrating. Tomahawk is not recommended. Use Richfaces or Icefaces. They are both beautiful and excellent and capable of some incredible "Web 2.0" effects. And they both work nicely with Seam. Last time I tried it Tomahawk does NOT work nicely with Seam.

          Problems with Seam: If there's a problem in the configuration, tracking it down and fixing it can be a major headache. Seam-gen should "just work" but it is not always the answer and it doesn't always just work. Once you learn all this config stuff you do eventually figure out how to debug config-related exceptions, but it's a painful learning process. My one hint to the Seam developers would be, it would be great if we had more informative exceptions that would give us more ideas where to look for problems.

          Good things about Seam: there is no better model for web development that I have ever seen. It lets you really focus on doing the work. Once config problems are sorted out, you can work directly with your objects. No more SQL, no more low-level HTML, no more writing validators. It'a amazing.

          • 2. Re: Some doubts about Seam
            Pete Muir Master

             

            "magoicochea" wrote:
            1.- How is persistence managed? Does it use EJB 3.0 persistence (I don't know much about EJB) or can I use hibernate? If it uses Hibernate how is it implemented? As usual with Hibernate or does it uses some kind of annotations for it?


            Seam provides a Seam Managed Persistence Context (EJB3/JPA) or you can use a Seam managed Hibernate Session. http://docs.jboss.com/seam/2.0.0.B1/reference/en/html/persistence.html#d0e5466

            2.- Can I use tomahawk components with seam? On the tutorial I saw that the url filter is "*.seam" when tomahawk needs "/faces/".


            Yes (Seam can of course use prefix mapping as well as suffix mapping), but we don't recommend Tomahawk as, when we last looked, it didn't work brilliantly with Seam. We would recommend Richfaces (obviously ;) ), Apache Trinidad, or perhaps Icefaces.

            • 3. Re: Some doubts about Seam
              Miguel Angel Goicochea Newbie

              Thanks for your answers, I have another questions:

              1.- When I developed applications with JSF I used a JSF/Spring/Hibernate architecure using Managed Beans/Services/DAOs, the managed beans had the presentation logic, the Services had the business logic and the DAOs had the data access logic, it was there were I performed my hibernate queries.

              On the examples I've seen the entity beans would be the object that I manipulated on with the DAOs, but I have also seen that the session bean contains data, business and presentation logic. The jsp is being managed from there, business rules are being applied on its methods and it is also making queries to the database. I suppose this is just for the simplicity of the event, but how can I separate efficiently this three layers? What's the closest thing you can do to the Service/DAO pattern on JBoss Seam?

              2.- When database queries were done on the example I didn't see any transaction being open, does JBoss Seam manage them transparently like Spring or were they omitted on the example?

              Thanks again

              • 4. Re: Some doubts about Seam
                Gavin King Master

                1. You can implement any architectural "pattern" you like with Seam, it does not impose an architecture. Of course, some things that were needed in J2EE or in JSF/Spring/Hibernate are simply not necessary in Seam.

                2. Check the documentation about Seam-managed transactions.