• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Transaction Attribute

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the important of transaction attribute in EJB
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is very important, especially if you spend hours debugging why something doesn't work, and you discover your deploy tool has magically switched your EJB business method from "required" to "not supported".

Besides all the other stuff that comes along with transactions, there is a critical container-provided service that transactional business methods are given. If you business method is transactional, then the container calls ejbLoad immediately before the transaction, and ejbStore immediately after.

The advantage of this is simplicity in your business methods. As a crude example:
If this was a business method that you send a boolean value, and it 'expires' the current Entry, how would this change get pushed back to the database? where is the code to do it? answer: in ejbStore... which gets called right after this transactional business method. I don't have to write the database storage code in each method. BTW: this is all assuming you are using BMP.
reply
    Bookmark Topic Watch Topic
  • New Topic