Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in afterCompletion

 
Venkatesh Rangamani
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranchers,
In EJB 2.0 Spec Pg 81, it is said that

Pt 1:
Invoking the getCallerPrincipal and isCallerInRole methods is disallowed in the session bean methods for which the Container does not have a client security context.

Pt 2:
"Accessing resource managers and enterprise beans is disallowed in the session bean methods for which the Container does not have a meaningful transaction context or client security context."

For afterCompletion method spec says we can call isCallerInRole so that means it has Security Context, then why is it not allowed to access Resource Managers or other beans according to Pt 2?

Thanks
Venkat.
 
NareshAnkuskani Kumar
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi venkatesh,

When there is no transaction context, you cannot access resource manager.

After the transaction is 'commited' or 'rolled back' then only 'afterCompletion' method is called. since the transaction is already completed and there is no meaning full transaction (no transaction context) left for 'afterCompletion' method we could not call any resource manager.

let me know i am correct or not

 
NareshAnkuskani Kumar
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one more point to remind you is

transaction context is for calling resouce managers.

security context is for calling other beans.

so, in 'afterCompletion' method you cannot access resource managers & can call other bean method.
 
Venkatesh Rangamani
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naresh

When there is no transaction context, you cannot access resource manager.

The Spec doesnt say so, the spec says there should be either Tx Context or Security Context to access the Resource manager and other beans!

So in afterCompletion we have security context (as calling gerCallerPrincipal) is allowed, so this means we should be able to access the Resource managers also. Am i Clear?

Thanks
Venkat
 
NareshAnkuskani Kumar
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Venkatesh,

I don't have the answer for the question you posted earlier. so i waited any one else in the group might answer but still i did not found the answer. So i posted the same in another forum. please find the conversation there.

I am not sure wheather it is good or bad to post the conversation held in some other forum at this place. But considering that the conversation will help you & others i am adding a link below to refer it.

please find the link
http://forum.java.sun.com/thread.jspa?threadID=5188530&messageID=9743543#9743543
 
Venkatesh Rangamani
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Very Much Naresh. I think its an oversight in the spec.

Venkat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic