----- Forwarded by Regis Piccand/T115682/SYSTOR on 11.07.2001 08:52 -----
                                                                                       
                            
                   regis.piccand@systor.                                               
                            
                                     com       To:  [EMAIL PROTECTED]          
                            
                   Sent by:                    cc:                                     
                            
                   owner-jonas-users@obj       Subject:  Re-post : Container-managed 
entity beans relationship ... 
                   ectweb.org                                                          
                            
                                                                                       
                            
                                                                                       
                            
                                                                                       
                            
                        04.07.2001 13:46                                               
                            
                                                                                       
                            
                                                                                       
                            




Hi all,

I am trying to model with entity beans two db tables which have a
one-to-one relationship. A "Fund" table and a "Company" table ; each fund
record has a "company_id" field which is the primary key to the "company"
table.

In my fund table, the "company_id" is a persistent field and is used in a
"getCompany()" call. Basically, I have a Company global variable (of class
Company - that extends EJBObject) that is instanciated via a context lookup
for CompanyHome (see code attached).

Up to now, I have not used the ejb-ref tags in the ejb-jar.xml file.

The problem is the following :

As the Company object is present is the FondsBean, I thought that I could
"cache" it and not do a lookup everytime a getCompany() call comes.
However, it seems that every instance of the FondsBean shares the same
Company object (have a reference to the same object) ; is this true ? Am I
doing something wrong here ?

If I do not cache the reference to the Company object (and therefore always
do a lookup), it works fine ...

As mentionned earlier, I have not used the ejb-ref tags in the deployement
descriptor. Is it really required ? What does it bring ? How does it work
with JOnAS ?

Thanks a lot in advance for your comments and best regards

R�gis

(See attached file: FondsClient.java)(See attached file: FondsBean.java)

PS I'm using JOnAS 2.2.6(See attached file: FondsClient.java)(See attached
file: FondsBean.java)


=?iso-8859-1?Q?FondsClient.java?=

=?iso-8859-1?Q?FondsBean.java?=

Reply via email to