• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bean things you can/can not do

 
Serghei Jelauc
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
I can't understand some things about the subject. For example: when we talk about entity beans, what can we do in setEntityContext method? HFEJB says, that the only things we can do are: get reference to your home, and we have access to the SPECIAL JNDI environment. One of the things we can't do is -we can't call another bean methods, couse we do not have access to them.
Here is it where I am a little bit confused: if I have access to the JNDI I can lookup another bean (let's say session bean) home, call it's create method and after all call any bussiness method of that bean. What does it mean when they say that I do not have access to another bean method? If I am not right - what does it mean "SPECIAL JNDI ENVIRONMENT"?

Thanks in advance.
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Serghei

The call to another bean has to be made in the context of a transaction whereas there is no transactional context associated with the setEntityContext method hence calls to other beans is not allowed in the setEntityContext method.

Thanks

-- Ravi
 
Serghei Jelauc
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the answer.
As I understand "not allowed" does not mean I can't do that. What will happen if I still try to call another bean method?
And from my first post - what is the difference between the access to the JNDI and access to another bean methods? I mean - If I have access to the JNDI then I can call another bean methods. Am I right?

Thanks.
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[ejbSpecs]If an entity bean instance attempts to invoke a method of the EntityContext interface, and the access is not allowed then the container must throw the java.lang.IllegalStateException.

And from my first post - what is the difference between the access to the JNDI and access to another bean methods? I mean - If I have access to the JNDI then I can call another bean methods. Am I right?

You have "JNDI access to java:comp/env" in setEntityContext method however the bean doesn't have "Enterprise bean access" in setEntityContext method. Both are different operations.
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I too have some doubts with the specifications on the things that we can/cannot do in methods.

On page 81 of the specifications:
Accessing resource managers & enterprise beans is disallowed in the session bean methods for which the Container does not have a meaningful transaction context or client security context.


Is "running with unspecified transaction context" the same as "without meaningful transaction context"?

On page 76 of the specifications:
A session bean's newInstance, setSessionContext, ejbCreate, ejbRemove, ejbPassivate, ejbActivate and afterCompletion methods are called with an unspecified transaction context.


Then, on page 80, the table showed that afterCompletion method cannot have accesses to another EJB nor resource managers.

How is it that the ejbCreate, ejbRemove, ejbActivate & ejbPassivate methods can have accesses to another EJB & resource managers? Aren't they suppose to be running with unspecified transaction context? What is so different between afterCompletion & the rest?

Does anyone have any clue? Is the specifications wrong? Or am I missing something important here?

Any help is much appreciated.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic