• 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:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

TransactionAttributeType.NEVER in Remote Interface

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I read that NEVER can be useful when you do not want developers to write Database critical code in a method, so that if they do that an exception would result. So while trying to practice that at home, i tried to decorate my interface method declaration with attribute @TransactionAttribute(TransactionAttributeType.NEVER) but no exceptions were thrown when i call the Session Bean without already having a transaction. Surprisingly, when i decorated the Session Bean's method (as opposed to the method declaration in interface) itself with @TransactionAttribute(TransactionAttributeType.NEVER), the same call results in an Exception. I am using jboss 5. What went wrong here? Can i not use @TransactionAttribute(TransactionAttributeType.NEVER) in the Remote Interface itself?

Thanks
Asif
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As per the EJB3.0 spec (section 13.3.7.1):


A transaction attribute may be specified on a method of the bean class to override the transaction attribute value explicitly or implicitly specified on the bean class.



So the transaction attribute is expected to be specified on the bean implementation class and not the interface(s).



 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hope this help:

http://download.oracle.com/javaee/5/tutorial/doc/bncij.html#bncirTable 33-1 Transaction Attributes and Scope


read this funny one Q/A http://stackoverflow.com/questions/1759554/examples-or-uses-cases-to-explain-ejb-transaction-attributes
 
Mustafa Garhi
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you guys.

I don't know how easy it is to go through any specs but i definitely need to learn that.

Closing this issue.

Cheers
Mustafa
 
I wish to win the lottery. I wish for a lovely piece of pie. And I wish for a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic