The answer is yes, you can. Why? That's still unclear to me. I've posed the question in several places, including this forum, and I haven't got a satisfactory answer, except that the spec says you can do it, so you can do it.
Well..Just a step further I guess I have got the ans to this..In the EJB 2.0 spec, on page 90 it says "Invoking getEJBObject is disallowed if the session object identity is not associated with the bean instance and shud throw IllegalStateException cause the access to this particular SessionContext methd is not allowd"
which means if the container goes on creating a pool before any request comes..then this stmt will hold true.
As am just a starter, hope we r going the correct way!! Others please share ur thoughts!! Thanks a lot!!
Well, that's not exactly what it says. Yes, any calls on the session context not allowed in table 3 (also on page 90) should cause an IllegalStateException. Also from that page:
Invoking the getEJBObject and getEJBLocalObject methods is disallowed in the session bean methods in which there is no session object identity associated with the instance.
However, that is just explaining why getEJBObject is not allowed by table 3 in certain places. Although, it would seem to be true for ejbCreate, table 3 specifically allows getEJBObject in ejbCreate. That doesn't make sense to me, and so far no one has been able to explain it, not even the people who claim it makes sense to them.
The practical consequences aren't very important. For the test, just memorize what the spec says for this case. For real life, don't access getEJBObject from the ejbCreate method for stateless session beans. There's no particular reason you'd have to anyway.
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop