• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

question about Transaction atrribute

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Assuming aMethod, bMethod, cMethod are methods of interface A, their transaction attributes are
REQUIRED, SUPPORTS, and REQUIRES_NEW respectively.

why,aMethod's transaction attribute is REQUIRED ?

If the bean class has superclasses, the following additional rules apply.
• A transaction attribute specified on a superclass S applies to the business methods defined by S.
If a class-level transaction attribute is not specified on S, it is equivalent to specification of
TransactionAttribute(REQUIRED) on S.
• A transaction attribute may be specified on a business method M defined by class S to override
for method M the transaction attribute value explicitly or implicitly specified on the class S.
• If a method M of class S overrides a business method defined by a superclass of S, the transaction
attribute of M is determined by the above rules as applied to class S.

I can't understand this rule....
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

why,aMethod's transaction attribute is REQUIRED ?



This is because aMethod is overridden by ABean and the default TransactionAttribute is "Required" for beans with CMT.

Further, what this rule says is transaction attributes are not inherited by the subclasses.

Hope this helps in your understanding.
 
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Further, what this rule says is transaction attributes are not inherited by the subclasses.



I think this is not about Inheritance of the transaction attribute though it correctly apply in such scenario.

In other words if aMethod() in ABean gets the Transaction attribute as "Required" by default which overrides the one that is specified in SomClass which is super class.

Hope this helps.
Amit
reply
    Bookmark Topic Watch Topic
  • New Topic