• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

rollback in SFSB

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SFSB
you can begin a transaction during ejbCreate() and commit/rollback in another business method
What will be effect when ejbCreate() is part of Txn start, and rollback happens in anotehr method?
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, the EJB Specification explicitly makes a point of not specifying the transactional context for the ejbCreate() lifecycle event of Session Beans (and a few other lifecycle methods). Some Application Servers may allow you to begin a transaction in ejbCreate(), others may not. Therefore, attempting to start a transaction in ejbCreate() of a Session Bean should be avoided if you are looking to create a portable solution.
For more information on this, see 17.6.5 of the EJB 2.0 Specification.
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
BTW, I am moving this to the EJB Forum...
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Some Application Servers may allow you to begin a transaction in ejbCreate(), others may not.


I feel it is a volation of ejb spec.
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pradeep Bhat:
I feel it is a volation of ejb spec.


Not at all. It states explicitly in the specification that the behavior is up to the EJB Container.

EJB 2.0 Specification, Section 17.6.5:
The EJB specification does not prescribe how the Container should manage the execution of a method with an unspecified transaction context�the transaction semantics are left to the Container implementation.

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

Originally posted by Chris Mathews:
Actually, the EJB Specification explicitly makes a point of not specifying the transactional context for the ejbCreate() lifecycle event of Session Beans (and a few other lifecycle methods). Some Application Servers may allow you to begin a transaction in ejbCreate(), others may not. Therefore, attempting to start a transaction in ejbCreate() of a Session Bean should be avoided if you are looking to create a portable solution.
For more information on this, see 17.6.5 of the EJB 2.0 Specification.


Hallo Chris,
Starting a transaction in the ejbCreate() of the SLSB makes no sense since the instances are pooled. Starting a transaction in the ejbCreate of the SFSB makes sense and is allowed by the EJB 2.0 spec. See the Chapter 7.6.1 (page 80, table 2 - BMT Demarcation).
Dragan
 
Water proof donuts! Eat them while reading this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic