This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests and have Scott Selikoff and Jeanne Boyarsky on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!

Harvey Chan

+ Follow
since Jan 06, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Harvey Chan

Why the API has no description at all?
It is not so useful for developer...
17 years ago
Why the API downloaded from AlphaWork is machine generated and
without any description?
This API document isn't help at all.
17 years ago
Hi kathy,
I don't agree the point u said about the method - AfterCompletion()
Also, notice that you cannot get access to another bean or a resource manager inside a stateful session bean's "afterCompletion" method (if you implement SessionSynchronization). So in setSessionContext and afterCompletion, you have access to java:comp/env, but cannot USE it for resource manager or bean access. The reason is because setSessionContext and afterCompletion are not running in a 'meaningful transaction context' or with a client security context.
As you can actually allowed to call the isCallerRole() and getCallerPrincipal() methods in afterCompletion. It proved that the client Security Context must exist there!
So, I really don't have any idea about why we can't access the EJB and
resource manager over afterCompletion ..............
I am really confuse and wanna understand it.................
Hi Philippe, may be I should try to understand the real world.

And thanks for David for always giving me a helpful hand~~~~~
Yup, I agreed that the transaction should not be there anymore.
However, in the definition, the rule for accessing resource manager
and EJB is releated to EITHER transaction context OR client security
So, if the client security context still there ( as proved by isCallerInRole() ), then why we can't access the recource manager ( because the rule said
OR not AND)
I started to think the specification is really confusing....
Why accessing Resource Manager and EJB is not allowed here?
Any reason behind?
I think the client secruity context still here because
it allowed us to use isCallerinRole() method..
Thanks for helping me always......
I have a problem in understanding the sequence order of CREATE<METHOD>
in Session Bean.
According to the OID of creation of a session bean. EJBObject was instaniated before invoking setSessionContext( ).
However, why NO EJBObject was attached to the sessionContext in
setSessionContext() while the EJBObject suddenly appears in the
ejbCreate() method?
This is strange to me because EJBHome run the ejbCreate() method
immediately after the setSessionContext().(without any hints that
any other thing has been run in between)
I am wondering if the CONTAINER has done something to the sessionContext
before running ejbCreate()?
And what is the reason behind not attaching the EJBObject to the
sessionContext in the setSessionContext method??
Thanks for your help~~~~~
Yup, I think u r correct. According to the diagram in the specification, there should not be any transaction in running ejbCreate..and etc.
But, still the same question, then why ejbCreate() method in statless cannot access other EJB, while stateful session bean can? At leaset, can get reference........... is the specification having problem??
I really want to understand it instead of memorize it..
Just come up in my mind, would it be like this?
1. Stateless session bean WON'T assigned any transaction when RUNNING methods like ejbCreate() and ejbRemove(). So, there would be NO meaningful transaction context when running these methods.
However, statless session bean WILL assign a transaction for ANY OTHER
business method. So, resources could be called.
2. Statful session bean WILL assigned transaction for methods like..ejbCreate(), ejbRemove(), ejbActivate().......
So that this methods call can use those resouces...

Am i correct??
Please correct my mistakes....
thanks so much
Actucally what i really confuse is .........
1. In both statful and statless session beans, the specification claimed that accessing resource manager and EJB is disallowed when there is no "meaningfull transaction context" OR "client Security Context".
(page 81 & page 91)
2. However, as you can see, stateful session bean allowed accessing the above objects in ejbCreate(), ejbRemove() and ......
But it was disallowed in statless session bean's ejbCreate() & ejbRemove().
3. I don't understand why statless and stateful session bean is different in this way. Does it means that statless session bean DON'T have "meaningful transaction context"? I am totally disagree about this because you can specify "transaction" method in statless session beans also. Am i correct?
So, what is the reason behind the differece of accessing ability of ejbCreate(), ejbRemove()... methods in statless and stateful session bean? Is it releated to the client security Context?
I noticed that seems looking up Local Object using
WebSphere 5 is like this...
Can anyone tell me whether this is VENDOR specific???
Same confusion here~~~
please answer...thanks thanks~~~~