• 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Why stateless bean is not allowed to access to resource manager in lifecycle callback method?

 
Bartender
Posts: 2119
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On p. 94 of JSR 318, table 1, it says:
A stateful bean is allowed to access resource manager in lifecycle callback interceptor methods.
The fact is for stateful bean, @PostConstruct, @PreDestroy, @PostActivate and @PrePassivate methods are executed in unspecified transaction and security context.

In table 2 on p.103, it says:
A stateless bean is not allowed to access resource manager in lifecycle callback interceptor methods.
The fact is for stateless bean, these lifecycle callback method are executed in unspecified transaction and security context as well.
On p. 76, it says


The PostConstruct lifecycle callback interceptor methods executed in an unspecified security context. The PostConstruct lifecycle callback interceptor method for stateless and stateful session bean execute in an unpsecified transaction context.
...


On p.105, it says:


The reason for disallowing operation in table 2:
...
Access resource managers ... is disallowed in the session bean method for which the container does not have a meaningful transaction context and or client security context.



My question:
For both stateful and stateless beans, the lifecycle callback methods are not run in meaningful transaction context. But why stateful bean can access the resource manager in lifecycle callback method, but stateless bean cannot do access to the resource manager in its lifecycle callback method?
 
You showed up just in time for the waffles! And 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
reply
    Bookmark Topic Watch Topic
  • New Topic