You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Jakob Braeuchi <jb...@gmx.ch> on 2004/01/03 12:09:38 UTC

MtoN-Testcases fail

hi all, armin

there are two new testcases failing in class MtoNMapping 
testInsertWithIndirectionTable and testInsertWithIndirectionTable_2.
imo these cases fail because we do not have persons in the project !
and thus the m:n implementors for the project are deleted.

jakob


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: MtoN-Testcases fail

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi,

Jakob Braeuchi wrote:
> hi armin,
> 
> the problem with sequence of stores is due to the fact that the 
> relationship-definition pointing from Project to Person had auto-update 
> = false ! when we use auto-update = true you can either store project, 
> person1 or person2 first. so there's nothing wrong with m:n storing :)
> 

Great news!
Thanks!

Armin

> jakob
> 
> Armin Waibel wrote:
> 
>> Hi Jakob,
>>
>> I removed the wrong/failing tests and update the tests for creation of 
>> persons with project.
>>
>> When I want to remove a project or persons do I have to take care of 
>> the store-method calls order too? Is there a test case doing this. Do 
>> we have documentation about this (if I have to do something special)?
>>
>> regards,
>> Armin
>>
>> Armin Waibel wrote:
>>
>>> Hi Jakob,
>>>
>>> Jakob Braeuchi wrote:
>>>
>>>> hi armin,
>>>>
>>>> i just commited a new MtoNMapping.
>>>>
>>>
>>> oops, I currently rewritten some of the test cases too.
>>> Try to merge the changes.
>>>
>>> Seems the order of store-statements is the crucial factor - not good 
>>> but it's ok. I think we should clearly document this in the docs with 
>>> an example.
>>> What do you think?
>>>
>>> regards,
>>> Armin
>>>
>>>
>>>> jakob
>>>>
>>>> Jakob Braeuchi wrote:
>>>>
>>>>> hi armin,
>>>>>
>>>>> testInsertWithIndirectionTable_3 fails because there's no project 
>>>>> with id = 4 , it has been deleted by a previous testcase.
>>>>>
>>>>> jakob
>>>>>
>>>>> Jakob Braeuchi wrote:
>>>>>
>>>>>> hi armin,
>>>>>>
>>>>>>
>>>>>> this is the code that works:
>>>>>>
>>>>>>         // create new project
>>>>>>         Project project = new Project();
>>>>>>         project.setTitle(title);
>>>>>>
>>>>>>         // create two persons and assign project
>>>>>>         // and assign persons with project
>>>>>>         Person p1 = new Person();
>>>>>>         p1.setFirstname(title);
>>>>>>         broker.store(p1);
>>>>>>
>>>>>>         List projects_1 = new ArrayList();
>>>>>>         projects_1.add(project);
>>>>>>         p1.setProjects(projects_1);
>>>>>>
>>>>>>         Person p2 = new Person();
>>>>>>         p2.setFirstname(title);
>>>>>>         broker.store(p2);
>>>>>>
>>>>>>         List projects_2 = new ArrayList();
>>>>>>         projects_2.add(project);
>>>>>>         p2.setProjects(projects_2);
>>>>>>
>>>>>>         ArrayList persons = new ArrayList();
>>>>>>         persons.add(p1);
>>>>>>         persons.add(p2);
>>>>>>         project.setPersons(persons);
>>>>>>
>>>>>>         broker.beginTransaction();
>>>>>>         broker.store(p1);
>>>>>>         broker.store(p2);
>>>>>>         broker.commitTransaction();
>>>>>>
>>>>>>
>>>>>> the perspn-project relationship is critical, it needs to be set 
>>>>>> bidirectionaly. the problem is then that the referenced person 
>>>>>> must alreay exist in the db or we'll get an integrity violation !
>>>>>>
>>>>>>
>>>>>> jakob
>>>>>>
>>>>>> Armin Waibel wrote:
>>>>>>
>>>>>>> Hi Jakob,
>>>>>>>
>>>>>>> hmm, I don't know how to change this behaviour - you are the 
>>>>>>> expert ;-)
>>>>>>>
>>>>>>> Please correct me if I misunderstood you. I modified/add 
>>>>>>> testInsertWithIndirectionTable tests:
>>>>>>>
>>>>>>> testInsertWithIndirectionTable_1:
>>>>>>> Add two new persons and one new project. Assign persons with the
>>>>>>> new project.
>>>>>>>
>>>>>>> testInsertWithIndirectionTable_2:
>>>>>>> Add two new persons and one new project. Assign persons to
>>>>>>> project and vice versa.
>>>>>>>
>>>>>>> testInsertWithIndirectionTable_3:
>>>>>>> Add two new persons to existing project
>>>>>>>
>>>>>>> testInsertWithIndirectionTable_4:
>>>>>>> Add two new persons to existing project and vice versa
>>>>>>>
>>>>>>> None of these tests pass!! If it's not a bug, what do I wrong.
>>>>>>> How do I create a new Project with two new Persons in one step?
>>>>>>> How do I add two new Persons to an existing Project in one step?
>>>>>>>
>>>>>>> regards,
>>>>>>> Armin
>>>>>>>
>>>>>>>
>>>>>>> Jakob Braeuchi wrote:
>>>>>>>
>>>>>>>> hi armin,
>>>>>>>>
>>>>>>>> ojb creates the role on inserting the project. on inserting the 
>>>>>>>> person
>>>>>>>>
>>>>>>>> storing project:
>>>>>>>> 1.) INSERT INTO PROJECT (ID,TITLE,DESCRIPTION) VALUES 
>>>>>>>> ('10','testInsertAndDelete_21073135938250','')
>>>>>>>>
>>>>>>>> storing person 1:
>>>>>>>> 2.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>>>>>>>> ('11','testInsertAndDelete_21073135938250','')
>>>>>>>> 3.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>>>>>>>> 4.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES 
>>>>>>>> ('11','10')
>>>>>>>>
>>>>>>>> storing person 2:
>>>>>>>> 5.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>>>>>>>> ('12','testInsertAndDelete_21073136478468','')
>>>>>>>> 6.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>>>>>>>> 7.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES 
>>>>>>>> ('12','10')
>>>>>>>>
>>>>>>>> as you can see the m:n implementors for the project are always 
>>>>>>>> deleted because the project is not associated with a person. 
>>>>>>>> this happens in the recursion store(), storeCollections(), 
>>>>>>>> store() when the person is stored.
>>>>>>>>
>>>>>>>> if (cds.isMtoNRelation())
>>>>>>>> {
>>>>>>>>   if (cds.getCascadeStore())
>>>>>>>>   {
>>>>>>>>    (steps 3 and 6)
>>>>>>>>    store(otherObj);
>>>>>>>>    currentMtoNKeys = mtoNBroker.getMtoNImplementor(cds, obj);
>>>>>>>>   }
>>>>>>>>   (steps 4 and 7)
>>>>>>>>   mtoNBroker.storeMtoNImplementor(cds, obj, otherObj, 
>>>>>>>> currentMtoNKeys); }
>>>>>>>>
>>>>>>>> i recently inserted the line currentMtoNKeys = ... after 
>>>>>>>> store(otherObject). because we had integrity violations.
>>>>>>>>
>>>>>>>> jakob
>>>>>>>>
>>>>>>>> Armin Waibel wrote:
>>>>>>>>
>>>>>>>>> Hi Jakob,
>>>>>>>>>
>>>>>>>>> Jakob Braeuchi wrote:
>>>>>>>>>
>>>>>>>>>> hi all, armin
>>>>>>>>>>
>>>>>>>>>> there are two new testcases failing in class MtoNMapping 
>>>>>>>>>> testInsertWithIndirectionTable and 
>>>>>>>>>> testInsertWithIndirectionTable_2.
>>>>>>>>>> imo these cases fail because we do not have persons in the 
>>>>>>>>>> project !
>>>>>>>>>> and thus the m:n implementors for the project are deleted.
>>>>>>>>>>
>>>>>>>>> hmm, but in class-descriptor for Person a collection-descriptor 
>>>>>>>>> with auto-update true for Project classes is set. OK I don't 
>>>>>>>>> have persons in the project object, but why should this prevent 
>>>>>>>>> creation of Roles. One Role(entry in indirection table) was 
>>>>>>>>> created, the second not?
>>>>>>>>>
>>>>>>>>> This test creates (store two new Person objects with same new 
>>>>>>>>> Project object) --->
>>>>>>>>> one new Project (in PERSON table) OK
>>>>>>>>> two new Persons (in PROJECT table) OK
>>>>>>>>> one new Role (in PERSON_PROJECT table) ??
>>>>>>>>>
>>>>>>>>> I checked in this test case because I assume it is a bug. 
>>>>>>>>> Either I get two Role entries or I get none entry. Why does OJB 
>>>>>>>>> create one Role?
>>>>>>>>>
>>>>>>>>> regards,
>>>>>>>>> Armin
>>>>>>>>>
>>>>>>>>>> jakob
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>>
>>>>>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>
>>>>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: MtoN-Testcases fail

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi armin,

the problem with sequence of stores is due to the fact that the 
relationship-definition pointing from Project to Person had auto-update 
= false ! when we use auto-update = true you can either store project, 
person1 or person2 first. so there's nothing wrong with m:n storing :)

jakob

Armin Waibel wrote:

> Hi Jakob,
> 
> I removed the wrong/failing tests and update the tests for creation of 
> persons with project.
> 
> When I want to remove a project or persons do I have to take care of the 
> store-method calls order too? Is there a test case doing this. Do we 
> have documentation about this (if I have to do something special)?
> 
> regards,
> Armin
> 
> Armin Waibel wrote:
> 
>> Hi Jakob,
>>
>> Jakob Braeuchi wrote:
>>
>>> hi armin,
>>>
>>> i just commited a new MtoNMapping.
>>>
>>
>> oops, I currently rewritten some of the test cases too.
>> Try to merge the changes.
>>
>> Seems the order of store-statements is the crucial factor - not good 
>> but it's ok. I think we should clearly document this in the docs with 
>> an example.
>> What do you think?
>>
>> regards,
>> Armin
>>
>>
>>> jakob
>>>
>>> Jakob Braeuchi wrote:
>>>
>>>> hi armin,
>>>>
>>>> testInsertWithIndirectionTable_3 fails because there's no project 
>>>> with id = 4 , it has been deleted by a previous testcase.
>>>>
>>>> jakob
>>>>
>>>> Jakob Braeuchi wrote:
>>>>
>>>>> hi armin,
>>>>>
>>>>>
>>>>> this is the code that works:
>>>>>
>>>>>         // create new project
>>>>>         Project project = new Project();
>>>>>         project.setTitle(title);
>>>>>
>>>>>         // create two persons and assign project
>>>>>         // and assign persons with project
>>>>>         Person p1 = new Person();
>>>>>         p1.setFirstname(title);
>>>>>         broker.store(p1);
>>>>>
>>>>>         List projects_1 = new ArrayList();
>>>>>         projects_1.add(project);
>>>>>         p1.setProjects(projects_1);
>>>>>
>>>>>         Person p2 = new Person();
>>>>>         p2.setFirstname(title);
>>>>>         broker.store(p2);
>>>>>
>>>>>         List projects_2 = new ArrayList();
>>>>>         projects_2.add(project);
>>>>>         p2.setProjects(projects_2);
>>>>>
>>>>>         ArrayList persons = new ArrayList();
>>>>>         persons.add(p1);
>>>>>         persons.add(p2);
>>>>>         project.setPersons(persons);
>>>>>
>>>>>         broker.beginTransaction();
>>>>>         broker.store(p1);
>>>>>         broker.store(p2);
>>>>>         broker.commitTransaction();
>>>>>
>>>>>
>>>>> the perspn-project relationship is critical, it needs to be set 
>>>>> bidirectionaly. the problem is then that the referenced person must 
>>>>> alreay exist in the db or we'll get an integrity violation !
>>>>>
>>>>>
>>>>> jakob
>>>>>
>>>>> Armin Waibel wrote:
>>>>>
>>>>>> Hi Jakob,
>>>>>>
>>>>>> hmm, I don't know how to change this behaviour - you are the 
>>>>>> expert ;-)
>>>>>>
>>>>>> Please correct me if I misunderstood you. I modified/add 
>>>>>> testInsertWithIndirectionTable tests:
>>>>>>
>>>>>> testInsertWithIndirectionTable_1:
>>>>>> Add two new persons and one new project. Assign persons with the
>>>>>> new project.
>>>>>>
>>>>>> testInsertWithIndirectionTable_2:
>>>>>> Add two new persons and one new project. Assign persons to
>>>>>> project and vice versa.
>>>>>>
>>>>>> testInsertWithIndirectionTable_3:
>>>>>> Add two new persons to existing project
>>>>>>
>>>>>> testInsertWithIndirectionTable_4:
>>>>>> Add two new persons to existing project and vice versa
>>>>>>
>>>>>> None of these tests pass!! If it's not a bug, what do I wrong.
>>>>>> How do I create a new Project with two new Persons in one step?
>>>>>> How do I add two new Persons to an existing Project in one step?
>>>>>>
>>>>>> regards,
>>>>>> Armin
>>>>>>
>>>>>>
>>>>>> Jakob Braeuchi wrote:
>>>>>>
>>>>>>> hi armin,
>>>>>>>
>>>>>>> ojb creates the role on inserting the project. on inserting the 
>>>>>>> person
>>>>>>>
>>>>>>> storing project:
>>>>>>> 1.) INSERT INTO PROJECT (ID,TITLE,DESCRIPTION) VALUES 
>>>>>>> ('10','testInsertAndDelete_21073135938250','')
>>>>>>>
>>>>>>> storing person 1:
>>>>>>> 2.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>>>>>>> ('11','testInsertAndDelete_21073135938250','')
>>>>>>> 3.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>>>>>>> 4.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES 
>>>>>>> ('11','10')
>>>>>>>
>>>>>>> storing person 2:
>>>>>>> 5.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>>>>>>> ('12','testInsertAndDelete_21073136478468','')
>>>>>>> 6.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>>>>>>> 7.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES 
>>>>>>> ('12','10')
>>>>>>>
>>>>>>> as you can see the m:n implementors for the project are always 
>>>>>>> deleted because the project is not associated with a person. this 
>>>>>>> happens in the recursion store(), storeCollections(), store() 
>>>>>>> when the person is stored.
>>>>>>>
>>>>>>> if (cds.isMtoNRelation())
>>>>>>> {
>>>>>>>   if (cds.getCascadeStore())
>>>>>>>   {
>>>>>>>    (steps 3 and 6)
>>>>>>>    store(otherObj);
>>>>>>>    currentMtoNKeys = mtoNBroker.getMtoNImplementor(cds, obj);
>>>>>>>   }
>>>>>>>   (steps 4 and 7)
>>>>>>>   mtoNBroker.storeMtoNImplementor(cds, obj, otherObj, 
>>>>>>> currentMtoNKeys); }
>>>>>>>
>>>>>>> i recently inserted the line currentMtoNKeys = ... after 
>>>>>>> store(otherObject). because we had integrity violations.
>>>>>>>
>>>>>>> jakob
>>>>>>>
>>>>>>> Armin Waibel wrote:
>>>>>>>
>>>>>>>> Hi Jakob,
>>>>>>>>
>>>>>>>> Jakob Braeuchi wrote:
>>>>>>>>
>>>>>>>>> hi all, armin
>>>>>>>>>
>>>>>>>>> there are two new testcases failing in class MtoNMapping 
>>>>>>>>> testInsertWithIndirectionTable and 
>>>>>>>>> testInsertWithIndirectionTable_2.
>>>>>>>>> imo these cases fail because we do not have persons in the 
>>>>>>>>> project !
>>>>>>>>> and thus the m:n implementors for the project are deleted.
>>>>>>>>>
>>>>>>>> hmm, but in class-descriptor for Person a collection-descriptor 
>>>>>>>> with auto-update true for Project classes is set. OK I don't 
>>>>>>>> have persons in the project object, but why should this prevent 
>>>>>>>> creation of Roles. One Role(entry in indirection table) was 
>>>>>>>> created, the second not?
>>>>>>>>
>>>>>>>> This test creates (store two new Person objects with same new 
>>>>>>>> Project object) --->
>>>>>>>> one new Project (in PERSON table) OK
>>>>>>>> two new Persons (in PROJECT table) OK
>>>>>>>> one new Role (in PERSON_PROJECT table) ??
>>>>>>>>
>>>>>>>> I checked in this test case because I assume it is a bug. Either 
>>>>>>>> I get two Role entries or I get none entry. Why does OJB create 
>>>>>>>> one Role?
>>>>>>>>
>>>>>>>> regards,
>>>>>>>> Armin
>>>>>>>>
>>>>>>>>> jakob
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>
>>>>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: MtoN-Testcases fail

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Jakob,

I removed the wrong/failing tests and update the tests for creation of 
persons with project.

When I want to remove a project or persons do I have to take care of the 
store-method calls order too? Is there a test case doing this. Do we 
have documentation about this (if I have to do something special)?

regards,
Armin

Armin Waibel wrote:

> Hi Jakob,
> 
> Jakob Braeuchi wrote:
> 
>> hi armin,
>>
>> i just commited a new MtoNMapping.
>>
> 
> oops, I currently rewritten some of the test cases too.
> Try to merge the changes.
> 
> Seems the order of store-statements is the crucial factor - not good but 
> it's ok. I think we should clearly document this in the docs with an 
> example.
> What do you think?
> 
> regards,
> Armin
> 
> 
>> jakob
>>
>> Jakob Braeuchi wrote:
>>
>>> hi armin,
>>>
>>> testInsertWithIndirectionTable_3 fails because there's no project 
>>> with id = 4 , it has been deleted by a previous testcase.
>>>
>>> jakob
>>>
>>> Jakob Braeuchi wrote:
>>>
>>>> hi armin,
>>>>
>>>>
>>>> this is the code that works:
>>>>
>>>>         // create new project
>>>>         Project project = new Project();
>>>>         project.setTitle(title);
>>>>
>>>>         // create two persons and assign project
>>>>         // and assign persons with project
>>>>         Person p1 = new Person();
>>>>         p1.setFirstname(title);
>>>>         broker.store(p1);
>>>>
>>>>         List projects_1 = new ArrayList();
>>>>         projects_1.add(project);
>>>>         p1.setProjects(projects_1);
>>>>
>>>>         Person p2 = new Person();
>>>>         p2.setFirstname(title);
>>>>         broker.store(p2);
>>>>
>>>>         List projects_2 = new ArrayList();
>>>>         projects_2.add(project);
>>>>         p2.setProjects(projects_2);
>>>>
>>>>         ArrayList persons = new ArrayList();
>>>>         persons.add(p1);
>>>>         persons.add(p2);
>>>>         project.setPersons(persons);
>>>>
>>>>         broker.beginTransaction();
>>>>         broker.store(p1);
>>>>         broker.store(p2);
>>>>         broker.commitTransaction();
>>>>
>>>>
>>>> the perspn-project relationship is critical, it needs to be set 
>>>> bidirectionaly. the problem is then that the referenced person must 
>>>> alreay exist in the db or we'll get an integrity violation !
>>>>
>>>>
>>>> jakob
>>>>
>>>> Armin Waibel wrote:
>>>>
>>>>> Hi Jakob,
>>>>>
>>>>> hmm, I don't know how to change this behaviour - you are the expert 
>>>>> ;-)
>>>>>
>>>>> Please correct me if I misunderstood you. I modified/add 
>>>>> testInsertWithIndirectionTable tests:
>>>>>
>>>>> testInsertWithIndirectionTable_1:
>>>>> Add two new persons and one new project. Assign persons with the
>>>>> new project.
>>>>>
>>>>> testInsertWithIndirectionTable_2:
>>>>> Add two new persons and one new project. Assign persons to
>>>>> project and vice versa.
>>>>>
>>>>> testInsertWithIndirectionTable_3:
>>>>> Add two new persons to existing project
>>>>>
>>>>> testInsertWithIndirectionTable_4:
>>>>> Add two new persons to existing project and vice versa
>>>>>
>>>>> None of these tests pass!! If it's not a bug, what do I wrong.
>>>>> How do I create a new Project with two new Persons in one step?
>>>>> How do I add two new Persons to an existing Project in one step?
>>>>>
>>>>> regards,
>>>>> Armin
>>>>>
>>>>>
>>>>> Jakob Braeuchi wrote:
>>>>>
>>>>>> hi armin,
>>>>>>
>>>>>> ojb creates the role on inserting the project. on inserting the 
>>>>>> person
>>>>>>
>>>>>> storing project:
>>>>>> 1.) INSERT INTO PROJECT (ID,TITLE,DESCRIPTION) VALUES 
>>>>>> ('10','testInsertAndDelete_21073135938250','')
>>>>>>
>>>>>> storing person 1:
>>>>>> 2.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>>>>>> ('11','testInsertAndDelete_21073135938250','')
>>>>>> 3.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>>>>>> 4.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES 
>>>>>> ('11','10')
>>>>>>
>>>>>> storing person 2:
>>>>>> 5.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>>>>>> ('12','testInsertAndDelete_21073136478468','')
>>>>>> 6.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>>>>>> 7.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES 
>>>>>> ('12','10')
>>>>>>
>>>>>> as you can see the m:n implementors for the project are always 
>>>>>> deleted because the project is not associated with a person. this 
>>>>>> happens in the recursion store(), storeCollections(), store() when 
>>>>>> the person is stored.
>>>>>>
>>>>>> if (cds.isMtoNRelation())
>>>>>> {
>>>>>>   if (cds.getCascadeStore())
>>>>>>   {
>>>>>>    (steps 3 and 6)
>>>>>>    store(otherObj);
>>>>>>    currentMtoNKeys = mtoNBroker.getMtoNImplementor(cds, obj);
>>>>>>   }
>>>>>>   (steps 4 and 7)
>>>>>>   mtoNBroker.storeMtoNImplementor(cds, obj, otherObj, 
>>>>>> currentMtoNKeys); }
>>>>>>
>>>>>> i recently inserted the line currentMtoNKeys = ... after 
>>>>>> store(otherObject). because we had integrity violations.
>>>>>>
>>>>>> jakob
>>>>>>
>>>>>> Armin Waibel wrote:
>>>>>>
>>>>>>> Hi Jakob,
>>>>>>>
>>>>>>> Jakob Braeuchi wrote:
>>>>>>>
>>>>>>>> hi all, armin
>>>>>>>>
>>>>>>>> there are two new testcases failing in class MtoNMapping 
>>>>>>>> testInsertWithIndirectionTable and 
>>>>>>>> testInsertWithIndirectionTable_2.
>>>>>>>> imo these cases fail because we do not have persons in the 
>>>>>>>> project !
>>>>>>>> and thus the m:n implementors for the project are deleted.
>>>>>>>>
>>>>>>> hmm, but in class-descriptor for Person a collection-descriptor 
>>>>>>> with auto-update true for Project classes is set. OK I don't have 
>>>>>>> persons in the project object, but why should this prevent 
>>>>>>> creation of Roles. One Role(entry in indirection table) was 
>>>>>>> created, the second not?
>>>>>>>
>>>>>>> This test creates (store two new Person objects with same new 
>>>>>>> Project object) --->
>>>>>>> one new Project (in PERSON table) OK
>>>>>>> two new Persons (in PROJECT table) OK
>>>>>>> one new Role (in PERSON_PROJECT table) ??
>>>>>>>
>>>>>>> I checked in this test case because I assume it is a bug. Either 
>>>>>>> I get two Role entries or I get none entry. Why does OJB create 
>>>>>>> one Role?
>>>>>>>
>>>>>>> regards,
>>>>>>> Armin
>>>>>>>
>>>>>>>> jakob
>>>>>>>>
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: MtoN-Testcases fail

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Jakob,

Jakob Braeuchi wrote:

> hi armin,
> 
> i just commited a new MtoNMapping.
> 

oops, I currently rewritten some of the test cases too.
Try to merge the changes.

Seems the order of store-statements is the crucial factor - not good but 
it's ok. I think we should clearly document this in the docs with an 
example.
What do you think?

regards,
Armin


> jakob
> 
> Jakob Braeuchi wrote:
> 
>> hi armin,
>>
>> testInsertWithIndirectionTable_3 fails because there's no project with 
>> id = 4 , it has been deleted by a previous testcase.
>>
>> jakob
>>
>> Jakob Braeuchi wrote:
>>
>>> hi armin,
>>>
>>>
>>> this is the code that works:
>>>
>>>         // create new project
>>>         Project project = new Project();
>>>         project.setTitle(title);
>>>
>>>         // create two persons and assign project
>>>         // and assign persons with project
>>>         Person p1 = new Person();
>>>         p1.setFirstname(title);
>>>         broker.store(p1);
>>>
>>>         List projects_1 = new ArrayList();
>>>         projects_1.add(project);
>>>         p1.setProjects(projects_1);
>>>
>>>         Person p2 = new Person();
>>>         p2.setFirstname(title);
>>>         broker.store(p2);
>>>
>>>         List projects_2 = new ArrayList();
>>>         projects_2.add(project);
>>>         p2.setProjects(projects_2);
>>>
>>>         ArrayList persons = new ArrayList();
>>>         persons.add(p1);
>>>         persons.add(p2);
>>>         project.setPersons(persons);
>>>
>>>         broker.beginTransaction();
>>>         broker.store(p1);
>>>         broker.store(p2);
>>>         broker.commitTransaction();
>>>
>>>
>>> the perspn-project relationship is critical, it needs to be set 
>>> bidirectionaly. the problem is then that the referenced person must 
>>> alreay exist in the db or we'll get an integrity violation !
>>>
>>>
>>> jakob
>>>
>>> Armin Waibel wrote:
>>>
>>>> Hi Jakob,
>>>>
>>>> hmm, I don't know how to change this behaviour - you are the expert ;-)
>>>>
>>>> Please correct me if I misunderstood you. I modified/add 
>>>> testInsertWithIndirectionTable tests:
>>>>
>>>> testInsertWithIndirectionTable_1:
>>>> Add two new persons and one new project. Assign persons with the
>>>> new project.
>>>>
>>>> testInsertWithIndirectionTable_2:
>>>> Add two new persons and one new project. Assign persons to
>>>> project and vice versa.
>>>>
>>>> testInsertWithIndirectionTable_3:
>>>> Add two new persons to existing project
>>>>
>>>> testInsertWithIndirectionTable_4:
>>>> Add two new persons to existing project and vice versa
>>>>
>>>> None of these tests pass!! If it's not a bug, what do I wrong.
>>>> How do I create a new Project with two new Persons in one step?
>>>> How do I add two new Persons to an existing Project in one step?
>>>>
>>>> regards,
>>>> Armin
>>>>
>>>>
>>>> Jakob Braeuchi wrote:
>>>>
>>>>> hi armin,
>>>>>
>>>>> ojb creates the role on inserting the project. on inserting the person
>>>>>
>>>>> storing project:
>>>>> 1.) INSERT INTO PROJECT (ID,TITLE,DESCRIPTION) VALUES 
>>>>> ('10','testInsertAndDelete_21073135938250','')
>>>>>
>>>>> storing person 1:
>>>>> 2.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>>>>> ('11','testInsertAndDelete_21073135938250','')
>>>>> 3.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>>>>> 4.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES 
>>>>> ('11','10')
>>>>>
>>>>> storing person 2:
>>>>> 5.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>>>>> ('12','testInsertAndDelete_21073136478468','')
>>>>> 6.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>>>>> 7.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES 
>>>>> ('12','10')
>>>>>
>>>>> as you can see the m:n implementors for the project are always 
>>>>> deleted because the project is not associated with a person. this 
>>>>> happens in the recursion store(), storeCollections(), store() when 
>>>>> the person is stored.
>>>>>
>>>>> if (cds.isMtoNRelation())
>>>>> {
>>>>>   if (cds.getCascadeStore())
>>>>>   {
>>>>>    (steps 3 and 6)
>>>>>    store(otherObj);
>>>>>    currentMtoNKeys = mtoNBroker.getMtoNImplementor(cds, obj);
>>>>>   }
>>>>>   (steps 4 and 7)
>>>>>   mtoNBroker.storeMtoNImplementor(cds, obj, otherObj, 
>>>>> currentMtoNKeys); }
>>>>>
>>>>> i recently inserted the line currentMtoNKeys = ... after 
>>>>> store(otherObject). because we had integrity violations.
>>>>>
>>>>> jakob
>>>>>
>>>>> Armin Waibel wrote:
>>>>>
>>>>>> Hi Jakob,
>>>>>>
>>>>>> Jakob Braeuchi wrote:
>>>>>>
>>>>>>> hi all, armin
>>>>>>>
>>>>>>> there are two new testcases failing in class MtoNMapping 
>>>>>>> testInsertWithIndirectionTable and testInsertWithIndirectionTable_2.
>>>>>>> imo these cases fail because we do not have persons in the project !
>>>>>>> and thus the m:n implementors for the project are deleted.
>>>>>>>
>>>>>> hmm, but in class-descriptor for Person a collection-descriptor 
>>>>>> with auto-update true for Project classes is set. OK I don't have 
>>>>>> persons in the project object, but why should this prevent 
>>>>>> creation of Roles. One Role(entry in indirection table) was 
>>>>>> created, the second not?
>>>>>>
>>>>>> This test creates (store two new Person objects with same new 
>>>>>> Project object) --->
>>>>>> one new Project (in PERSON table) OK
>>>>>> two new Persons (in PROJECT table) OK
>>>>>> one new Role (in PERSON_PROJECT table) ??
>>>>>>
>>>>>> I checked in this test case because I assume it is a bug. Either I 
>>>>>> get two Role entries or I get none entry. Why does OJB create one 
>>>>>> Role?
>>>>>>
>>>>>> regards,
>>>>>> Armin
>>>>>>
>>>>>>> jakob
>>>>>>>
>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: MtoN-Testcases fail

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi armin,

i just commited a new MtoNMapping.

jakob

Jakob Braeuchi wrote:

> hi armin,
> 
> testInsertWithIndirectionTable_3 fails because there's no project with 
> id = 4 , it has been deleted by a previous testcase.
> 
> jakob
> 
> Jakob Braeuchi wrote:
> 
>> hi armin,
>>
>>
>> this is the code that works:
>>
>>         // create new project
>>         Project project = new Project();
>>         project.setTitle(title);
>>
>>         // create two persons and assign project
>>         // and assign persons with project
>>         Person p1 = new Person();
>>         p1.setFirstname(title);
>>         broker.store(p1);
>>
>>         List projects_1 = new ArrayList();
>>         projects_1.add(project);
>>         p1.setProjects(projects_1);
>>
>>         Person p2 = new Person();
>>         p2.setFirstname(title);
>>         broker.store(p2);
>>
>>         List projects_2 = new ArrayList();
>>         projects_2.add(project);
>>         p2.setProjects(projects_2);
>>
>>         ArrayList persons = new ArrayList();
>>         persons.add(p1);
>>         persons.add(p2);
>>         project.setPersons(persons);
>>
>>         broker.beginTransaction();
>>         broker.store(p1);
>>         broker.store(p2);
>>         broker.commitTransaction();
>>
>>
>> the perspn-project relationship is critical, it needs to be set 
>> bidirectionaly. the problem is then that the referenced person must 
>> alreay exist in the db or we'll get an integrity violation !
>>
>>
>> jakob
>>
>> Armin Waibel wrote:
>>
>>> Hi Jakob,
>>>
>>> hmm, I don't know how to change this behaviour - you are the expert ;-)
>>>
>>> Please correct me if I misunderstood you. I modified/add 
>>> testInsertWithIndirectionTable tests:
>>>
>>> testInsertWithIndirectionTable_1:
>>> Add two new persons and one new project. Assign persons with the
>>> new project.
>>>
>>> testInsertWithIndirectionTable_2:
>>> Add two new persons and one new project. Assign persons to
>>> project and vice versa.
>>>
>>> testInsertWithIndirectionTable_3:
>>> Add two new persons to existing project
>>>
>>> testInsertWithIndirectionTable_4:
>>> Add two new persons to existing project and vice versa
>>>
>>> None of these tests pass!! If it's not a bug, what do I wrong.
>>> How do I create a new Project with two new Persons in one step?
>>> How do I add two new Persons to an existing Project in one step?
>>>
>>> regards,
>>> Armin
>>>
>>>
>>> Jakob Braeuchi wrote:
>>>
>>>> hi armin,
>>>>
>>>> ojb creates the role on inserting the project. on inserting the person
>>>>
>>>> storing project:
>>>> 1.) INSERT INTO PROJECT (ID,TITLE,DESCRIPTION) VALUES 
>>>> ('10','testInsertAndDelete_21073135938250','')
>>>>
>>>> storing person 1:
>>>> 2.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>>>> ('11','testInsertAndDelete_21073135938250','')
>>>> 3.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>>>> 4.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES 
>>>> ('11','10')
>>>>
>>>> storing person 2:
>>>> 5.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>>>> ('12','testInsertAndDelete_21073136478468','')
>>>> 6.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>>>> 7.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES 
>>>> ('12','10')
>>>>
>>>> as you can see the m:n implementors for the project are always 
>>>> deleted because the project is not associated with a person. this 
>>>> happens in the recursion store(), storeCollections(), store() when 
>>>> the person is stored.
>>>>
>>>> if (cds.isMtoNRelation())
>>>> {
>>>>   if (cds.getCascadeStore())
>>>>   {
>>>>    (steps 3 and 6)
>>>>    store(otherObj);
>>>>    currentMtoNKeys = mtoNBroker.getMtoNImplementor(cds, obj);
>>>>   }
>>>>   (steps 4 and 7)
>>>>   mtoNBroker.storeMtoNImplementor(cds, obj, otherObj, 
>>>> currentMtoNKeys); }
>>>>
>>>> i recently inserted the line currentMtoNKeys = ... after 
>>>> store(otherObject). because we had integrity violations.
>>>>
>>>> jakob
>>>>
>>>> Armin Waibel wrote:
>>>>
>>>>> Hi Jakob,
>>>>>
>>>>> Jakob Braeuchi wrote:
>>>>>
>>>>>> hi all, armin
>>>>>>
>>>>>> there are two new testcases failing in class MtoNMapping 
>>>>>> testInsertWithIndirectionTable and testInsertWithIndirectionTable_2.
>>>>>> imo these cases fail because we do not have persons in the project !
>>>>>> and thus the m:n implementors for the project are deleted.
>>>>>>
>>>>> hmm, but in class-descriptor for Person a collection-descriptor 
>>>>> with auto-update true for Project classes is set. OK I don't have 
>>>>> persons in the project object, but why should this prevent creation 
>>>>> of Roles. One Role(entry in indirection table) was created, the 
>>>>> second not?
>>>>>
>>>>> This test creates (store two new Person objects with same new 
>>>>> Project object) --->
>>>>> one new Project (in PERSON table) OK
>>>>> two new Persons (in PROJECT table) OK
>>>>> one new Role (in PERSON_PROJECT table) ??
>>>>>
>>>>> I checked in this test case because I assume it is a bug. Either I 
>>>>> get two Role entries or I get none entry. Why does OJB create one 
>>>>> Role?
>>>>>
>>>>> regards,
>>>>> Armin
>>>>>
>>>>>> jakob
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: MtoN-Testcases fail

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi armin,

testInsertWithIndirectionTable_3 fails because there's no project with 
id = 4 , it has been deleted by a previous testcase.

jakob

Jakob Braeuchi wrote:

> hi armin,
> 
> 
> this is the code that works:
> 
>         // create new project
>         Project project = new Project();
>         project.setTitle(title);
> 
>         // create two persons and assign project
>         // and assign persons with project
>         Person p1 = new Person();
>         p1.setFirstname(title);
>         broker.store(p1);
> 
>         List projects_1 = new ArrayList();
>         projects_1.add(project);
>         p1.setProjects(projects_1);
> 
>         Person p2 = new Person();
>         p2.setFirstname(title);
>         broker.store(p2);
> 
>         List projects_2 = new ArrayList();
>         projects_2.add(project);
>         p2.setProjects(projects_2);
> 
>         ArrayList persons = new ArrayList();
>         persons.add(p1);
>         persons.add(p2);
>         project.setPersons(persons);
> 
>         broker.beginTransaction();
>         broker.store(p1);
>         broker.store(p2);
>         broker.commitTransaction();
> 
> 
> the perspn-project relationship is critical, it needs to be set 
> bidirectionaly. the problem is then that the referenced person must 
> alreay exist in the db or we'll get an integrity violation !
> 
> 
> jakob
> 
> Armin Waibel wrote:
> 
>> Hi Jakob,
>>
>> hmm, I don't know how to change this behaviour - you are the expert ;-)
>>
>> Please correct me if I misunderstood you. I modified/add 
>> testInsertWithIndirectionTable tests:
>>
>> testInsertWithIndirectionTable_1:
>> Add two new persons and one new project. Assign persons with the
>> new project.
>>
>> testInsertWithIndirectionTable_2:
>> Add two new persons and one new project. Assign persons to
>> project and vice versa.
>>
>> testInsertWithIndirectionTable_3:
>> Add two new persons to existing project
>>
>> testInsertWithIndirectionTable_4:
>> Add two new persons to existing project and vice versa
>>
>> None of these tests pass!! If it's not a bug, what do I wrong.
>> How do I create a new Project with two new Persons in one step?
>> How do I add two new Persons to an existing Project in one step?
>>
>> regards,
>> Armin
>>
>>
>> Jakob Braeuchi wrote:
>>
>>> hi armin,
>>>
>>> ojb creates the role on inserting the project. on inserting the person
>>>
>>> storing project:
>>> 1.) INSERT INTO PROJECT (ID,TITLE,DESCRIPTION) VALUES 
>>> ('10','testInsertAndDelete_21073135938250','')
>>>
>>> storing person 1:
>>> 2.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>>> ('11','testInsertAndDelete_21073135938250','')
>>> 3.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>>> 4.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES ('11','10')
>>>
>>> storing person 2:
>>> 5.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>>> ('12','testInsertAndDelete_21073136478468','')
>>> 6.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>>> 7.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES ('12','10')
>>>
>>> as you can see the m:n implementors for the project are always 
>>> deleted because the project is not associated with a person. this 
>>> happens in the recursion store(), storeCollections(), store() when 
>>> the person is stored.
>>>
>>> if (cds.isMtoNRelation())
>>> {
>>>   if (cds.getCascadeStore())
>>>   {
>>>    (steps 3 and 6)
>>>    store(otherObj);
>>>    currentMtoNKeys = mtoNBroker.getMtoNImplementor(cds, obj);
>>>   }
>>>   (steps 4 and 7)
>>>   mtoNBroker.storeMtoNImplementor(cds, obj, otherObj, 
>>> currentMtoNKeys); }
>>>
>>> i recently inserted the line currentMtoNKeys = ... after 
>>> store(otherObject). because we had integrity violations.
>>>
>>> jakob
>>>
>>> Armin Waibel wrote:
>>>
>>>> Hi Jakob,
>>>>
>>>> Jakob Braeuchi wrote:
>>>>
>>>>> hi all, armin
>>>>>
>>>>> there are two new testcases failing in class MtoNMapping 
>>>>> testInsertWithIndirectionTable and testInsertWithIndirectionTable_2.
>>>>> imo these cases fail because we do not have persons in the project !
>>>>> and thus the m:n implementors for the project are deleted.
>>>>>
>>>> hmm, but in class-descriptor for Person a collection-descriptor with 
>>>> auto-update true for Project classes is set. OK I don't have persons 
>>>> in the project object, but why should this prevent creation of 
>>>> Roles. One Role(entry in indirection table) was created, the second 
>>>> not?
>>>>
>>>> This test creates (store two new Person objects with same new 
>>>> Project object) --->
>>>> one new Project (in PERSON table) OK
>>>> two new Persons (in PROJECT table) OK
>>>> one new Role (in PERSON_PROJECT table) ??
>>>>
>>>> I checked in this test case because I assume it is a bug. Either I 
>>>> get two Role entries or I get none entry. Why does OJB create one Role?
>>>>
>>>> regards,
>>>> Armin
>>>>
>>>>> jakob
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: MtoN-Testcases fail

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi armin,


this is the code that works:

         // create new project
         Project project = new Project();
         project.setTitle(title);

         // create two persons and assign project
         // and assign persons with project
         Person p1 = new Person();
         p1.setFirstname(title);
         broker.store(p1);

         List projects_1 = new ArrayList();
         projects_1.add(project);
         p1.setProjects(projects_1);

         Person p2 = new Person();
         p2.setFirstname(title);
         broker.store(p2);

         List projects_2 = new ArrayList();
         projects_2.add(project);
         p2.setProjects(projects_2);

         ArrayList persons = new ArrayList();
         persons.add(p1);
         persons.add(p2);
         project.setPersons(persons);

         broker.beginTransaction();
         broker.store(p1);
         broker.store(p2);
         broker.commitTransaction();


the perspn-project relationship is critical, it needs to be set 
bidirectionaly. the problem is then that the referenced person must 
alreay exist in the db or we'll get an integrity violation !


jakob

Armin Waibel wrote:

> Hi Jakob,
> 
> hmm, I don't know how to change this behaviour - you are the expert ;-)
> 
> Please correct me if I misunderstood you. I modified/add 
> testInsertWithIndirectionTable tests:
> 
> testInsertWithIndirectionTable_1:
> Add two new persons and one new project. Assign persons with the
> new project.
> 
> testInsertWithIndirectionTable_2:
> Add two new persons and one new project. Assign persons to
> project and vice versa.
> 
> testInsertWithIndirectionTable_3:
> Add two new persons to existing project
> 
> testInsertWithIndirectionTable_4:
> Add two new persons to existing project and vice versa
> 
> None of these tests pass!! If it's not a bug, what do I wrong.
> How do I create a new Project with two new Persons in one step?
> How do I add two new Persons to an existing Project in one step?
> 
> regards,
> Armin
> 
> 
> Jakob Braeuchi wrote:
> 
>> hi armin,
>>
>> ojb creates the role on inserting the project. on inserting the person
>>
>> storing project:
>> 1.) INSERT INTO PROJECT (ID,TITLE,DESCRIPTION) VALUES 
>> ('10','testInsertAndDelete_21073135938250','')
>>
>> storing person 1:
>> 2.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>> ('11','testInsertAndDelete_21073135938250','')
>> 3.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>> 4.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES ('11','10')
>>
>> storing person 2:
>> 5.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
>> ('12','testInsertAndDelete_21073136478468','')
>> 6.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
>> 7.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES ('12','10')
>>
>> as you can see the m:n implementors for the project are always deleted 
>> because the project is not associated with a person. this happens in 
>> the recursion store(), storeCollections(), store() when the person is 
>> stored.
>>
>> if (cds.isMtoNRelation())
>> {
>>   if (cds.getCascadeStore())
>>   {
>>    (steps 3 and 6)
>>    store(otherObj);
>>    currentMtoNKeys = mtoNBroker.getMtoNImplementor(cds, obj);
>>   }
>>   (steps 4 and 7)
>>   mtoNBroker.storeMtoNImplementor(cds, obj, otherObj, currentMtoNKeys); }
>>
>> i recently inserted the line currentMtoNKeys = ... after 
>> store(otherObject). because we had integrity violations.
>>
>> jakob
>>
>> Armin Waibel wrote:
>>
>>> Hi Jakob,
>>>
>>> Jakob Braeuchi wrote:
>>>
>>>> hi all, armin
>>>>
>>>> there are two new testcases failing in class MtoNMapping 
>>>> testInsertWithIndirectionTable and testInsertWithIndirectionTable_2.
>>>> imo these cases fail because we do not have persons in the project !
>>>> and thus the m:n implementors for the project are deleted.
>>>>
>>> hmm, but in class-descriptor for Person a collection-descriptor with 
>>> auto-update true for Project classes is set. OK I don't have persons 
>>> in the project object, but why should this prevent creation of Roles. 
>>> One Role(entry in indirection table) was created, the second not?
>>>
>>> This test creates (store two new Person objects with same new Project 
>>> object) --->
>>> one new Project (in PERSON table) OK
>>> two new Persons (in PROJECT table) OK
>>> one new Role (in PERSON_PROJECT table) ??
>>>
>>> I checked in this test case because I assume it is a bug. Either I 
>>> get two Role entries or I get none entry. Why does OJB create one Role?
>>>
>>> regards,
>>> Armin
>>>
>>>> jakob
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: MtoN-Testcases fail

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Jakob,

hmm, I don't know how to change this behaviour - you are the expert ;-)

Please correct me if I misunderstood you. I modified/add 
testInsertWithIndirectionTable tests:

testInsertWithIndirectionTable_1:
Add two new persons and one new project. Assign persons with the
new project.

testInsertWithIndirectionTable_2:
Add two new persons and one new project. Assign persons to
project and vice versa.

testInsertWithIndirectionTable_3:
Add two new persons to existing project

testInsertWithIndirectionTable_4:
Add two new persons to existing project and vice versa

None of these tests pass!! If it's not a bug, what do I wrong.
How do I create a new Project with two new Persons in one step?
How do I add two new Persons to an existing Project in one step?

regards,
Armin


Jakob Braeuchi wrote:

> hi armin,
> 
> ojb creates the role on inserting the project. on inserting the person
> 
> storing project:
> 1.) INSERT INTO PROJECT (ID,TITLE,DESCRIPTION) VALUES 
> ('10','testInsertAndDelete_21073135938250','')
> 
> storing person 1:
> 2.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
> ('11','testInsertAndDelete_21073135938250','')
> 3.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
> 4.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES ('11','10')
> 
> storing person 2:
> 5.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
> ('12','testInsertAndDelete_21073136478468','')
> 6.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
> 7.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES ('12','10')
> 
> as you can see the m:n implementors for the project are always deleted 
> because the project is not associated with a person. this happens in the 
> recursion store(), storeCollections(), store() when the person is stored.
> 
> if (cds.isMtoNRelation())
> {
>   if (cds.getCascadeStore())
>   {
>    (steps 3 and 6)
>    store(otherObj);
>    currentMtoNKeys = mtoNBroker.getMtoNImplementor(cds, obj);
>   }
>   (steps 4 and 7)
>   mtoNBroker.storeMtoNImplementor(cds, obj, otherObj, currentMtoNKeys); }
> 
> i recently inserted the line currentMtoNKeys = ... after 
> store(otherObject). because we had integrity violations.
> 
> jakob
> 
> Armin Waibel wrote:
> 
>> Hi Jakob,
>>
>> Jakob Braeuchi wrote:
>>
>>> hi all, armin
>>>
>>> there are two new testcases failing in class MtoNMapping 
>>> testInsertWithIndirectionTable and testInsertWithIndirectionTable_2.
>>> imo these cases fail because we do not have persons in the project !
>>> and thus the m:n implementors for the project are deleted.
>>>
>> hmm, but in class-descriptor for Person a collection-descriptor with 
>> auto-update true for Project classes is set. OK I don't have persons 
>> in the project object, but why should this prevent creation of Roles. 
>> One Role(entry in indirection table) was created, the second not?
>>
>> This test creates (store two new Person objects with same new Project 
>> object) --->
>> one new Project (in PERSON table) OK
>> two new Persons (in PROJECT table) OK
>> one new Role (in PERSON_PROJECT table) ??
>>
>> I checked in this test case because I assume it is a bug. Either I get 
>> two Role entries or I get none entry. Why does OJB create one Role?
>>
>> regards,
>> Armin
>>
>>> jakob
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: MtoN-Testcases fail

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi armin,

ojb creates the role on inserting the project. on inserting the person

storing project:
1.) INSERT INTO PROJECT (ID,TITLE,DESCRIPTION) VALUES 
('10','testInsertAndDelete_21073135938250','')

storing person 1:
2.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
('11','testInsertAndDelete_21073135938250','')
3.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
4.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES ('11','10')

storing person 2:
5.) INSERT INTO PERSON (ID,FIRSTNAME,LASTNAME) VALUES 
('12','testInsertAndDelete_21073136478468','')
6.) DELETE FROM PERSON_PROJECT WHERE PROJECT_ID='10'
7.) INSERT INTO PERSON_PROJECT (PERSON_ID,PROJECT_ID) VALUES ('12','10')

as you can see the m:n implementors for the project are always deleted 
because the project is not associated with a person. this happens in the 
recursion store(), storeCollections(), store() when the person is stored.

if (cds.isMtoNRelation())
{
   if (cds.getCascadeStore())
   {
    (steps 3 and 6)
    store(otherObj);
    currentMtoNKeys = mtoNBroker.getMtoNImplementor(cds, obj);
   }
   (steps 4 and 7)
   mtoNBroker.storeMtoNImplementor(cds, obj, otherObj, currentMtoNKeys); }

i recently inserted the line currentMtoNKeys = ... after 
store(otherObject). because we had integrity violations.

jakob

Armin Waibel wrote:
> Hi Jakob,
> 
> Jakob Braeuchi wrote:
> 
>> hi all, armin
>>
>> there are two new testcases failing in class MtoNMapping 
>> testInsertWithIndirectionTable and testInsertWithIndirectionTable_2.
>> imo these cases fail because we do not have persons in the project !
>> and thus the m:n implementors for the project are deleted.
>>
> hmm, but in class-descriptor for Person a collection-descriptor with 
> auto-update true for Project classes is set. OK I don't have persons in 
> the project object, but why should this prevent creation of Roles. One 
> Role(entry in indirection table) was created, the second not?
> 
> This test creates (store two new Person objects with same new Project 
> object) --->
> one new Project (in PERSON table) OK
> two new Persons (in PROJECT table) OK
> one new Role (in PERSON_PROJECT table) ??
> 
> I checked in this test case because I assume it is a bug. Either I get 
> two Role entries or I get none entry. Why does OJB create one Role?
> 
> regards,
> Armin
> 
>> jakob
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: MtoN-Testcases fail

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Jakob,

Jakob Braeuchi wrote:
> hi all, armin
> 
> there are two new testcases failing in class MtoNMapping 
> testInsertWithIndirectionTable and testInsertWithIndirectionTable_2.
> imo these cases fail because we do not have persons in the project !
> and thus the m:n implementors for the project are deleted.
> 
hmm, but in class-descriptor for Person a collection-descriptor with 
auto-update true for Project classes is set. OK I don't have persons in 
the project object, but why should this prevent creation of Roles. One 
Role(entry in indirection table) was created, the second not?

This test creates (store two new Person objects with same new Project 
object) --->
one new Project (in PERSON table) OK
two new Persons (in PROJECT table) OK
one new Role (in PERSON_PROJECT table) ??

I checked in this test case because I assume it is a bug. Either I get 
two Role entries or I get none entry. Why does OJB create one Role?

regards,
Armin

> jakob
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org