4 Replies Latest reply on Oct 28, 2011 7:32 PM by lightguard

    Is there a Seam 3 equivalent to Seam 2's @Install?

    benkirby

      Hi, I mistakenly asked this last week in the Seam Users forum. Unsurprisingly met with silence, so reposting in this here, as seems more appropriate. Anyone any ideas?


      In  http://seamframework.org/Community/AS7QuartzAsyncTransactionsCouldNotDiscoverTransactionStatus, Chris Lowe provides an elegant way of making Seam Persistence look at the new AS7 JNDI location, java:jboss/UserTransaction, for a UserTransaction.


      This uses Seam 2, and involves installing a bespoke component with @Install and @BypassInterceptors to override default Seam behaviour.


      However, I'm using Seam 3, and can't find an equivalent way of doing this from the API docs. Can anyone help?


      Thanks,
      Ben

        • 1. Re: Is there a Seam 3 equivalent to Seam 2's @Install?
          lightguard

          I have to say, I'm a little confused about what you want to do. Seam3 has no notion of installation precedence. If you're looking to override a bean that's been installed there are a couple of ways to do this.



          • 2. Re: Is there a Seam 3 equivalent to Seam 2's @Install?
            benkirby

            Ahhh, of course - good ideas! Thanks!


            The issue is that JBoss AS 7.0.1.Final now makes UserTransaction available on the global jndiname

            java:jboss/UserTransaction

            . The Seam3 class DefaultSeamTransaction obviously only tries to look up UserTransaction from where it knew it could be, previously:
            java:comp/UserTransaction

            and
            UserTransaction

            . So, on non-EE threads, it never finds the UserTransaction.


            So I need to replace the class DefaultSeamTransaction with a version of my own, which additionally attempts to lookup UserTransaction from the new, AS7 location, where it will be available. Chris did this in Seam2 with @Install.


            So if I create the specialized/alternate class in one of my JARs (packaged in an EAR), enable the alternate in the beans.xml, and otherwise follow the instructions, it should be able to replace DefaultSeamTransaction? The seam-persistence jar which is currently bundled in the same EAR.


            I'll give it a go anyway, thanks for the suggestion!

            • 3. Re: Is there a Seam 3 equivalent to Seam 2's @Install?
              yangju.richard.yang.pearson.com
              Have you figured out the with Specilizes and Alternatives?
              I was trying the same approach as it seems that Seam 3.1.0.Beta4(latest I can find for seam-transaction) still has not fixed this.

              However, I run into the same issue of
              https://issues.jboss.org/browse/WELD-912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
              (The fix is said to be in weld 1.2 but it is not there yet)
              So I cannot replace the DefaultSeamTransaction with my own code.

              Any suggest how to get around with this issue?
              • 4. Re: Is there a Seam 3 equivalent to Seam 2's @Install?
                lightguard