• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Himai Minh
Ranch Hand
Posts: 1574
10
  • 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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!