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

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

 
Ranch Foreman
Posts: 1922
13
  • Mark post as helpful
  • send pies
  • 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?
 
What's brown and sticky? ... a stick. Or a tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic