Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

@Asynchronous method VS @TransactionAttribute(TransactionAttributeType....)

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I've just read on enthuware software session bean quiz (oce-ejbd.v6.2.407) that "The transaction context of the caller is never propagated to the target bean's asynchronous method".

So if the asynchronous method has @TransactionAttribute(TransactionAttributeType.REQUIRED) (for CMT bean, of course) and caller has its own transaction context, the container create a new transaction and the TransactionAttribute.REQUIRED behaviour become the same of @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW).

Of course for @TransactionAttribute(TransactionAttributeType.NOT_SUPPORT) and @TransactionAttribute(TransactionAttributeType.NEVER) no transaction is created for asynchronous method.

But, what happen if asynchronous method is annotated with @TransactionAttribute(TransactionAttributeType.SUPPORT) and @TransactionAttribute(TransactionAttributeType.MANDATORY) and caller has its own transaction context?

I've just tryed on weblogic express (using transaction monitoring page) and TransactionAttribute works like normal method.

Is it vendor specific ?
I'm a little bit confused.

Thanks.
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, For Asynchronous method only REQUIRED, REQUIRES_NEW AND NOT_SUPPORTED transaction attributes are allowed.

https://docs.oracle.com/javaee/6/api/javax/ejb/TransactionAttributeType.html
 
He repaced his skull with glass. So you can see his brain. Kinda like this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic