-
1. Re: Circular CMR
dsundstrom Apr 29, 2002 4:06 PM (in response to jhicks)What do you mean by a curcular cmr?
-
2. Re: Circular CMR
leonxpelk Apr 29, 2002 7:24 PM (in response to jhicks)If I understand it: making relation from one Entity CMP Bean to itself? I think it is a good question. I've got the same problem. (I need object tree) Is it possible?
-
3. Re: Circular CMR
dsundstrom Apr 29, 2002 8:41 PM (in response to jhicks)It works fine for me. Are you using RC1?
-
4. Re: Circular CMR
jhicks Apr 30, 2002 7:23 PM (in response to jhicks)Im using rc1 with Postgresql. I have ProductEJB that references itself. Ive tried the first 3 commit options (A,B,C) and several different combinations of transactions. I have tried passing the pk of the child to the parent where the parent does a lookup and gets an instance to the child, then sets the CMR field. Ive also tried just creating my parent first, then from the slsb calling the setCMR field on the parent with a local reference to the child
My environment is the default (without tomcat), with the exception of postgres.
My design is application -> remotesession -> localentity
How are your beans designed/configured?
I can actually post the code sometimes tonight when I get home. -
5. Re: Circular CMR
dsundstrom Apr 30, 2002 11:56 PM (in response to jhicks)Say you have an emplyee has a supervisor and subordinates relationship. You would have the folling accessors int the employee object
public abstract Employee getSupervisor(); public abstract void setSupervisor(); public abstract Collection getSubordinates(); public abstract void setSubordinates();
Right? Declare the relationship in the ejb-jar.xml file.
Then in your client code you do the following:Employee myBoss = EmployeeHome.creat("Boss"); Employee me = EmployeeHome.creat("Boss"); me.setSupervisor(myBoss);
Of course you have to do this on the serverside. Just put the code in a session bean.