what is the jndi you are looking up?  is it by any chance "java:comp/env/ejb/OtherEJB" or something similar (the comp/env/ejb bit)?  If so, then what is happening is the session bean has a reference to the other entity bean, but the entity bean does not.  The answer is then in your deployment descriptors.
 
there no doubt could be 10 other answers, but this springs to mind.
 
hth
dim
----- Original Message -----
Sent: Monday, January 07, 2002 1:28 PM
Subject: Can Entity Bean Reference Another Entity Bean using Lookup

Hi all
 
Just wondering :
 
Is it possible for a local entity bean to contain code that lookups another local entity.
 
Setting Description:
 
An entity bean called Breed is must contain entity Type.
I pass a Value Object to the Breed bean. 
The bean :
    obtains the TypeId PK from the VO.
    looks up the JNDI name (errors here, see description below) for the TypeHome
    finds the Type record using the TypeId (PK) via the FindbyPrimaryKey function for the TypeHome.
    sets it type CMR to the found type record
 
Error Description: but an error occurs here while doing the lookup. It says, that the JNDI name cannot be found.
 
However, if I move this to a session bean which does exactly the same. It works. For clarity the session bean:
    accepts the Value Object
    obtains the TypeId PK from the VO.
    looks up the JNDI name  for the TypeHome (works!!!!)
    finds the Type record using the TypeId (PK) via the FindbyPrimaryKey function for the TypeHome.
    sets it type CMR to the found Type record
 
Why???????? Does it work in the session and not entity.
 
TIA
Glenn

Reply via email to