4 Replies Latest reply on Sep 19, 2007 7:13 AM by Carlo de Wolf

    How set transaction timeout at method level?

    Gustav Rånby Newbie

      I am probably missing something obvious but; how do I set transaction timeout at method level? I found a descriptor for doing this but I didn?t manage to make it work. I tried this on the stateless example:

      meta-inf/jboss.xml:

      <enterprise-beans>

      <ejb-name>org.jboss.tutorial.stateless.bean.CalculatorBean</ejb-name>

      <method-attributes>

      <method-name>add</method-name>
      <transaction-timeout>1</transaction-timeout>


      <method-name>subtract</method-name>
      <transaction-timeout>20</transaction-timeout>

      </method-attributes>

      </enterprise-beans>

      Since I am also unsure about how to connect these settings to the Calculator bean, I wasn?t very hopeful. My guess was the ejb-name attribute but what should I put there? Or is there an annotation that I have completely missed?

      So actually this is two questions in one:

      How do I add additional attributes via a deployment descriptor to an EJB3 session bean?

      Is there an annotation for setting transaction timeout for a method in a stateless session bean?