Transaction attribute


EJB programming & troubleshooting: Transaction attribute

  1. Transaction attribute (2 messages)

    I have one session bean that calls another entity bean for reading some data from database, i want to know what is neccessary transaction attribute for both session bean's methods and entity's. i want to know is it neccessary to have transaction for this kind of work? is better to mark methods of my entity bean as read-only ?

    Platform:j2ee1.3 , jboss 3.2, struts 1.1, mysql
    thanx a lot.
    --Amir Hossein

    Threaded Messages (2)

  2. Transaction attribute[ Go to top ]


      You can go through EJB 2.0 specs chapter 17. I have done many posting on this topic, will give you some pointers to the same.
      Sorry cant write the whole thing again. but the concept is it all depends what kind of behaviour are you expecting from your beans and depending on that you can decide on the transaction type you want.

    To get EJB specs, you can download it from Java 2 Platform, Enterprise Edition (J2EE)

    Please follow the thread Transactions - Posted By: Padeepkumar Anandan on July 28, 2003 @ 03:44 AM

    Hope this helps
  3. Transaction attribute[ Go to top ]

    Absent other considerations, I recommend that people give read-only operations a transaction attribute of "Supported". That way, you there is no transaction when all you are doing is reading, and there is a transaction when updates are involved.

    This recommendation does assume that you are using Data Transfer Object or Value Objects or the server's data caching features. If you are not, you need to expirement carefully. Because Entity beans must be synchronized with the database, careless use of an Entity beans outside a transaction can generate a lot of extraneous database calls.

    I suggest you put together some simple tests, giving your operations various transaction attributes and seeing which runs faster. That way you will know for sure.