I'm trying to model a rather complex tree structure with BMP EntityBeans. Each
one a one parent and several childs, as well as other links to others objects.
So i have to retrieve those links when a node is loaded from the database, in my
readData method:
// Get foreign keys in database
RankPK rankPrimaryKey= new RankPK(rs.getInt("rank_id")); 
TaxonPK parentPrimaryKey=new TaxonPK(rs.getInt("parent_id")); 
// Get a generic home interface to cast it several times
EJBHome home=getHomeInterface("RankHome");
// Get rank objet
RankHome rankHome=(RankHome)home;
rank=rankHome.findByPrimaryKey(rankPrimaryKey);
// Get parent and child nodes
TaxonHome taxonHome=(TaxonHome)home;
parentTaxon=taxonHome.findByPrimaryKey(parentPrimaryKey);
childTaxons=taxonHome.findByParentPrimaryKey(primaryKey);

And here's my getHomeInterface method :
private EJBHome getHomeInterface(String interfaceName){
    if (verboseMode) System.out.println("Bean "+id()+"; getHomeInterface called");
    EJBHome home = null;
    home=(EJBHome)PortableRemoteObject.narrow(ctx.lookup(interfaceName),EJBHome.class);
    return home;
  }
The problem is i have an error with the ctx.lookup(interfaceName) : no such
method in javax.ejb.EntityContext. It was altough OK in the client
application, with a more general Context Class.
So, is there a maybe more efficient way to get a Home interface in my bean, so
te be able to have find() methods ? I must say i'm not really OK with
context... And can i move this generic method to a static class as an EJBHelper
?

Just a word about my whole design : i thought to use entity beans for each
business entities (my nodes, in the present case), and then some session for
some management task, like browsing the whole structure, and so on. But i must
say that i feel very limited by entity design, even BMP, to stay close to my
relational model, rather to have a full object semantic representation. Maybe i'm
in a wrong way ?

Thanks for your help.

 -- 
Guillaume Rousse

Iremia - Universit� de la R�union
15 avenue Ren� Cassin, BP 7151
97715 Saint Denis, messagerie cedex 9
Tel:0262938330 Fax:0262938260 ICQ:10756815

BRIDGEKEEPER: What... is the air-speed velocity of an unladen swallow?
ARTHUR: What do you mean? An African or European swallow?
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to