2 Replies Latest reply on Jan 22, 2009 7:04 PM by Daniele Gariboldi

    Seam-wicket transaction and lifecycle

    Daniele Gariboldi Newbie
      I have a problem with seam managed transactions (if they exist at all in seam-wicket).
      I'm already a seam-JSF user and now I'm setting up a new project based on seam and wicket, using tomcat,JPA (RESOURCE_LOCAL transactions) and POJO.
      Testing my setup I see bijection, JPA and wicket instrumentation working.
      In a wicket-form-submit a can retrive an entity using the injected entityManager, but no transaction is bound to this entityManager.
      Using JSF seam manages two transactions, one updatable and the other read-only for the render-phase.
      When does seam start transaction/s in wicket, in particular in a tomcat-jpa-no jta environment?

      Seam 2.1.1GA tomcat 6 , configuration will follow if required.

        • 1. Re: Seam-wicket transaction and lifecycle
          Clint Popetz Apprentice

          It is true that Seam/Wicket doesn't create transactions for you.  It is however a lot easier to do it yourself in Wicket than in JSF, because you're always operating in java.  So for instance, you could abstract into a base WebPage class something like:

          protected void onBeforeRender()

          and similarly with onAfterRenderChildren.

          I think Seam/Wicket should do something like this by default, but I'll need to ponder exactly how.  So I've opened JBSEAM-3909

          Your suggestions are also welcome.

          • 2. Re: Seam-wicket transaction and lifecycle
            Daniele Gariboldi Newbie

            I think I'll not miss seam transaction mananagement, but I think it should be documented this difference between seam-jsf and seam-wicket.
            I like your suggestion on onBeforeRender and onAfterRenderChildren.

            I read once Gavin saying it's important to use even a read-only transaction in the render phase (of JSF, but applies to wicket too and regards lazy loading in hibernate): he said it helps the db for performance if I remember it right.

            For my business layer, i prefer to have control on my transactions and it's along wicket philosophy to control behaviour in java code, without any magic happening behind your code.

            Thanks for the ready answer, I'll contribute as soon as I can.