Discussions

EJB design: 'Supports' vs 'Notsupported' for a non-TX method

  1. Hi all,

    I'd posted this message in the Programming and Trouble- shooting forum also... probably it belongs here...
     
    I am unable to decide between using 'Supports' and 'NotSupported' for a Stateless Session Bean method that does not do any DML operations (directly or indirectly).

    If 'NotSupported' is specified, I am told that there is a small overhead for suspending and resuming the client's transaction context.

    And if 'Supports' is specified - we avoid this overhead, but I am told that there is a cost for 'monitoring' the non-transactional DB statements (SELECTs, to be precise).
    So which is better? Or are there other issues to consider before deciding?

    And while I am here, I want a good example for a situation that suggests the use of 'Supports' attribute. (esp. considering the fact that 'Supports' methods behave in a chameleon kind of way wrt transactions)

    Grateful for any inputs.
  2. Hi Ananth,

    I guess you know the solution yourself. If you already have your SLSB methods, just test it with Supports and NotSupported tx attribs and use whichever is taking less time.

    However, I would prefer and advice NotSupported since you are always sure that your method will never execute with a transaction, unless there are major performance difference or concurrency and locking issues.

    Hemant
    www.pramati.com