Is this C++ specific issue? I see the below output for DAS Java - RelationshipTests.testRelationshipModification2() - which is correct behavior.
Before move of order from cust2 to cust1 <?xml version="1.0" encoding="ASCII"?> <cust1:cust1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cust1="cust1" xmlns:das="http:///org.apache.tuscany.das.rdb/das" xsi:type="das:CUSTOMER"> <ID>1</ID> <LASTNAME>Williams</LASTNAME> <ADDRESS>1212 foobar lane</ADDRESS> <orders>root.xml#//@ANORDER.0</orders> <orders>root.xml#//@ANORDER.1</orders> </cust1:cust1> <?xml version="1.0" encoding="ASCII"?> <cust2:cust2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cust2="cust2" xmlns:das="http:///org.apache.tuscany.das.rdb/das" xsi:type="das:CUSTOMER"> <ID>2</ID> <LASTNAME>Daniel</LASTNAME> <ADDRESS>156 Brentfield Loop</ADDRESS> <orders>root.xml#//@ANORDER.2</orders> <orders>root.xml#//@ANORDER.3</orders> </cust2:cust2> After move of order from cust2 to cust1 <?xml version="1.0" encoding="ASCII"?> <cust1:cust1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cust1="cust1" xmlns:das="http:///org.apache.tuscany.das.rdb/das" xsi:type="das:CUSTOMER"> <ID>1</ID> <LASTNAME>Williams</LASTNAME> <ADDRESS>1212 foobar lane</ADDRESS> <orders>root.xml#//@ANORDER.0</orders> <orders>root.xml#//@ANORDER.1</orders> <orders>root.xml#//@ANORDER.2</orders> </cust1:cust1> <?xml version="1.0" encoding="ASCII"?> <cust2:cust2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cust2="cust2" xmlns:das="http:///org.apache.tuscany.das.rdb/das" xsi:type="das:CUSTOMER"> <ID>2</ID> <LASTNAME>Daniel</LASTNAME> <ADDRESS>156 Brentfield Loop</ADDRESS> <orders>root.xml#//@ANORDER.3</orders> </cust2:cust2> After applyChanges() and re-query <?xml version="1.0" encoding="ASCII"?> <cust1:cust1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cust1="cust1" xmlns:das="http:///org.apache.tuscany.das.rdb/das" xsi:type="das:CUSTOMER"> <ID>1</ID> <LASTNAME>Williams</LASTNAME> <ADDRESS>1212 foobar lane</ADDRESS> <orders>root.xml#//@ANORDER.0</orders> <orders>root.xml#//@ANORDER.1</orders> <orders>root.xml#//@ANORDER.2</orders> </cust1:cust1> <?xml version="1.0" encoding="ASCII"?> <cust2:cust2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cust2="cust2" xmlns:das="http:///org.apache.tuscany.das.rdb/das" xsi:type="das:CUSTOMER"> <ID>2</ID> <LASTNAME>Daniel</LASTNAME> <ADDRESS>156 Brentfield Loop</ADDRESS> <orders>root.xml#//@ANORDER.0</orders> </cust2:cust2> Regards, Amita On 10/6/07, Adriano Crestani <[EMAIL PROTECTED]> wrote: > > Hi again Kelvin, > > I created this thread a long time ago and you answered me that SDO does > not > support MxN relatioships between objects. The code above removes the first > department from the first company and adds it to the second company. I > expected that the reference the first company had to that department would > be removed automatically, but it's not being: > > ... > commonj::sdo::DataObjectPtr company1 = root->getDataObject("company[1]"); > commonj::sdo::DataObjectPtr company2 = root->getDataObject("company[2]"); > > company1->printSelf(cout); > company2->printSelf(cout); > > commonj::sdo::DataObjectPtr department = > company1->getDataObject("department[1]"); > company2->getList("department").append(department); > > company1->printSelf(cout); > company2->printSelf(cout); > ... > > Output: > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start of DO > DataObject type: apache.das#company > Property: id > Property Type: commonj.sdo#Int > Property Value: 1 > Property: name > Property Type: commonj.sdo#String > Property Value: apache > Property: department > Property Type: apache.das#department > Value 0 > Reference Value: #/department.0 > > Value 1 > Reference Value: #/department.1 > > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end of do > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start of DO > DataObject type: apache.das#company > Property: id > Property Type: commonj.sdo#Int > Property Value: 2 > Property: name > Property Type: commonj.sdo#String > Property Value: acme > Property: department > Property Type: apache.das#department > Value 0 > Reference Value: #/department.2 > > Value 1 > Reference Value: #/department.3 > > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end of do > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start of DO > DataObject type: apache.das#company > Property: id > Property Type: commonj.sdo#Int > Property Value: 1 > Property: name > Property Type: commonj.sdo#String > Property Value: apache > Property: department > Property Type: apache.das#department > Value 0 > Reference Value: #/department.0 > > Value 1 > Reference Value: #/department.1 > > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end of do > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start of DO > DataObject type: apache.das#company > Property: id > Property Type: commonj.sdo#Int > Property Value: 2 > Property: name > Property Type: commonj.sdo#String > Property Value: acme > Property: department > Property Type: apache.das#department > Value 0 > Reference Value: #/department.2 > > Value 1 > Reference Value: #/department.3 > > Value 2 > Reference Value: #/department.0 > > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end of do > > So, as the output shows, the department.0 is added on the company2, but > the > reference to department.0 that company1 has is not removed. Should it work > like this? > > Regards, > Adriano Crestani > > On 4/27/07, Adriano Crestani <[EMAIL PROTECTED]> wrote: > > > > Thanks Kevin : ) > > > > Adriano Crestani > > > > On 4/27/07, Kevin Williams <[EMAIL PROTECTED]> wrote: > > > > > > There is no way to morph a 1:m relationship into a M:M > > > relationship. SDO > > > maintains referential integrity. If you have a dept1 with emp1 and > then > > > execute: > > > > > > dep2.getEmployees.add(emp1) > > > > > > the graph will automagically remove emp1 from dep1's list of employees > > > and > > > you are left with valid 1:m relationships. > > > > > > --Kevin > > > > > > > > > On 4/27/07, Adriano Crestani < [EMAIL PROTECTED]> wrote: > > > > > > > > As described on > > > > http://wiki.apache.org/ws/ForeignKeyRepresentationAndManagement if a > > > table > > > > EMPLOYEE has a FK to a table DEPARTMENT it's mapped on the sdo graph > > > as > > > > the > > > > DEPARTMENT containing a list of EMPLOYEEs, So it's a 1xN > relationship. > > > > However, if the sdo graph, after being created and populated, is > > > modified > > > > and two different DEPARTMENT DataObjects reference the same EMPLOYEE > > > > DataObject the relationship turns to NxN. > > > > > > > > How does the Java DAS handle that? Does it throw an exception? > > > > > > > > Adriano Crestani > > > > > > > > > > > >
