But doesn't it pose a big limitation for DAS RDB ? I mean associations are not necessarily containment relations. I want to able to assign an existing employee to and existing department or a more intuitive example would be relationship between "customer service agent" and "customer". How am I ever going to achieve that with DAS RDB?
Thanks -Umesh Tyagi -----Original Message----- From: Kevin Williams [mailto:[EMAIL PROTECTED] Sent: Monday, April 23, 2007 3:07 PM To: [email protected] Subject: Re: RDB DAS - How to create non containment association ? On 4/23/07, Umesh Tyagi (utyagi) <[EMAIL PROTECTED]> wrote: > > So whenever I want to associate employees to a department I either > create a new employee or move employee from some other department ? That's right. I am talking about the case when a "employee" object is currently > without any associated department. When we want to assign it to a > department the following query will not include the employee I am > interested in - "select * from DEPARTMENT left outer join EMPLOYEE on > DEPARTMENT.ID = EMPLOYEE.DEPARTMENTID " > A right join on the other hand will leave out all the 'departmemt' > objects without any employee. > Thanks > -Umesh Tyagi > > > -----Original Message----- > From: Kevin Williams [mailto:[EMAIL PROTECTED] > Sent: Monday, April 23, 2007 12:43 PM > To: [email protected] > Subject: Re: RDB DAS - How to create non containment association ? > > If you want departments and their related employees then you would > typically use a left join rather than a full join. At least, this is > the scenario I see used most often. Our test case: > > RelationshipTests.testRelationshipModification2() > > demonstrates this. > > Thanks, > > --Kevin > > > > To read a set of departments and related employees you would typically > use a left outer join rather than a full join since you want > > On 4/21/07, Umesh Tyagi (utyagi) <[EMAIL PROTECTED]> wrote: > > > > How to create non containment association between two existing > > objects > ? > > For example, lets assume the following relationship is a non > > containment association i.e. both objects can exist independently of > > each other - > > > > ------------ ---------- > > |DEPARTMENT| 1______________* |EMPLOYEE| > > ------------ ---------- > > > > Playing with samples code I have noticed that in order to create > > association between two object they need to be part of the same data > > graph generated by a single query. So for the following line to work > > - > > > > department.getList("employees").add(employee) > > > > both 'department' and 'employee' dataobjects must be under same root > > DataObject instance. To achieve this I tried to do a full outer join > > between DEPARTMENT and EMPLOYEE but it is not supported by derby or > > hsql. The equivalent union result is not typed to DEPARTMENT and > > EMPLOYEE by DAS. The other option is to set the foreign key value > > explicitly in the 'employee' object, but it is not desirable. Any > > other ideas ? > > > > -Umesh Tyagi > > > > -------------------------------------------------------------------- > > - To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
