1 2 Previous Next 15 Replies Latest reply on Apr 22, 2009 9:57 PM by dan.j.allen

    How to hide Transaction Failed message?

    mcsous

      Hello Community,


      I have Spring 2.5 and seam 2.0.2 working together in the same project. I'm having some troubles with transaction. When a spring method throws a rollback transaction, seam add a Transaction Failed message to JSF messages.


      My components.xml looks like:


       <core:init transaction-management-enabled="true" debug="false"/>
      <spring:context-loader/>
      <spring:spring-transaction platform-transaction-manager="#{transactionManager}"/>
      



      And my Spring transaction configs look like:


      <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"/>
      <tx:annotation-driven proxy-target-class="false" mode="proxy"/>



      Is there anything that I can do?


      ps: I can't set proxy-target-class to true because some transactions doesn't rollback fine!

        • 1. Re: How to hide Transaction Failed message?
          nickarls

          Tried nulling the org.jboss.seam.TransactionFailed key in your properties files?

          • 2. Re: How to hide Transaction Failed message?
            mcsous

            This not work... another idea?

            • 3. Re: How to hide Transaction Failed message?
              nickarls

              Well if you have edited away the value and the text still appears then one thing that comes to mind is that you haven't edited the correct thing ;-)

              • 4. Re: How to hide Transaction Failed message?
                mcsous

                ok, but appears to me an empty message.

                • 5. Re: How to hide Transaction Failed message?
                  nickarls

                  If you really hate the message you can override addTransactionFailedMessage in SeamPhaseListener. Hmm, there has to be a more simple way.

                  • 6. Re: How to hide Transaction Failed message?
                    gena

                    I've got the same issue. I think it's unnecessary here to raise a FacesMessage, because the web page user shouldn't be informed about the transaction failure.


                    If we need, we could add a more meaningful message on a transaction failure but just in appropriate form within a controller and not from framework.


                    In my case, i expect those exception but will not inform the user about it.

                    • 7. Re: How to hide Transaction Failed message?
                      dan.j.allen

                      Actually, the correct solution for this problem would be to have a FacesTransactionEvents which observes the transaction failed event. That way, if you don't want the event, it's just a matter of overriding the FacesTransactionEvents component either to disable it or do your own thing. You can see this handoff used with security-related events and messages.


                      Can you file a JIRA?

                      • 8. Re: How to hide Transaction Failed message?
                        dan.j.allen

                        JBSEAM-3116


                        Anyone want to create a patch?

                        • 9. Re: How to hide Transaction Failed message?

                          Resolution of JBSEAM-2989 will fix a whole class of Seam's over verbose messages problems. This one as well.


                          Please fix/vote for JBSEAM-2989 instead.

                          • 10. Re: How to hide Transaction Failed message?
                            arnieoag

                            I too am getting this message in my queue and don't even know where its coming from!


                            Isn't there a way to prevent it in the first place - like turning off this transaction service if I'm not using it?


                            What kind of transaction is this about anyway?

                            • 11. Re: How to hide Transaction Failed message?
                              ikhnaton
                              If anyone's still looking for it, here's a hack that works to hide the message.  Just call as your last call before returning control to Seam.

                              try
                              {
                                 if (Transaction.instance().isRolledBackOrMarkedRollback())
                                 {
                                    if (Transaction.instance() instanceof UTTransaction)
                                    {
                                       UTTransaction trans = (UTTransaction) Transaction.instance();
                                       trans.rollback();
                                    }
                                 }
                              }
                              catch (SystemException e1)
                              {
                                 logger.error(e);
                              }
                              • 12. Re: How to hide Transaction Failed message?
                                hhcofcmds

                                Seam 2.1.1.GA still adds the message from the SeamPhaseListener, which you cannot avoid. 2.1.2.CR1 introduced the FacesTransactionEvents class to add the message, so finally we are at the same point, however, that class allows you to avoid the adding of the message. You can call this at some point of your initialization:
                                               


                                ((FacesTransactionEvents)Component.
                                    getInstance("org.jboss.seam.transaction.facesTransactionEvents")).
                                    setTransactionFailedMessageEnabled(false);
                                



                                However, this should be configurable in SEAM, so vote for My Link

                                • 13. Re: How to hide Transaction Failed message?
                                  dan.j.allen

                                  There is a much easier way to disable the message than what you suggest, and the approach is configurable. Just add the following to a seam.properties file:


                                  org.jboss.seam.transaction.facesTransactionEvents.transactionFailedMessageEnabled=false



                                  You can also do this in a component descriptor (components.xml):


                                  <component name="org.jboss.seam.transaction.facesTransactionEvents">
                                      <property name="transactionFailedMessageEnabled">false</property>
                                  </component>



                                  I haven't created a namespaced element for this yet. I haven't decided actually. In that case, it could be as simple as:


                                  <tx:faces-transaction-events transaction-failed-message-enabled="false"/>



                                  You can use that today, but it won't validate in your IDE.

                                  • 14. Re: How to hide Transaction Failed message?
                                    hhcofcmds

                                    Thanks, this works well. (I didn't know about this way to configure SEAM component properties, probably I should have read the manual more carefully).

                                    1 2 Previous Next