1 Reply Latest reply on Apr 5, 2004 5:40 PM by Collin

    newbie question: transaction (CMT)

    jchang Newbie

      Hello everybody,

      I have several question about CMT that hopefully you can help me out with:

      * When I don't declare any type of transaction for a specific method in a session bean, how is this method considered under JBoss?. I read somewhere that JBoss treats them as "supports" (transaction type) by default. It's that true.

      * I have declared my finder methods in an entity bean to have transaction type "NotSupported". But I read in the ejb 2.0 spec that they strongly advise us to use only the "Required", "RequiresNew" and "Mandatory" in entity beans. Why would I want to create transactions for methods that only find data in the database. And again, If I dont' put any transaction type in an entity bean method, how JBoss treats them by default?.

      * Are private methods inside session beans considered part of a transaction. In other words, Does JBoss creates a transaction when a private method is use in a session bean.

      I apologize in advance if any of these question doesn't make sense.

      Thanks for the help

      jchang

        • 1. Re: newbie question: transaction (CMT)
          Collin Novice

          * I have declared my finder methods in an entity bean to have transaction type "NotSupported". But I read in the ejb 2.0 spec that they strongly advise us to use only the "Required", "RequiresNew" and "Mandatory" in entity beans. Why would I want to create transactions for methods that only find data in the database. And again, If I dont' put any transaction type in an entity bean method, how JBoss treats them by default?.

          If your finder methods use on-find read-ahead, then the read-ahead cache is only valid for the lifetime of the transaction in which the finder was invoked. By not having a transactional context in which you use the beans you get back from the finder method, you will incur extra db time overhead.

          * Are private methods inside session beans considered part of a transaction. In other words, Does JBoss creates a transaction when a private method is use in a session bean.

          If the business method of your session bean is marked to use a transaction, then any private methods that that method calls will execute under the current transactional context.