You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Markus Späth <Ma...@mathema.de> on 2003/09/29 09:01:45 UTC

Problem with non-decomposed bidirectional m:n mappings

Hi!

I have the same problem that Lars Soltau posted on 02 Apr 2003 but I found no answer to his question.

I refer to the Person-Project example in the advanced O/R tutorial. If I do it like the example code and build the bidirectional relationship between person and project only by putting a project in the project collection of person and then call broker.store(person) it's all right.
OJB makes correct entries in the tables PERSON, PROJECT and PERSON_PROJECT. Afterwards I call broker.getObjectByQuery and I can navigate from person to project and from project to person. So far so good.

But for performance reasons I don't want to call broker.store(person) every time I add a project to the person. And I have to navigate immediately from project to person.
But to do so I have to make an entry in person (add the project to the collection) and in project (add the person to the collection) and if I call broker.store(person) now the PERSON_PROJECT table contains two identical entries and broker.getObjectByQuery supplies a person object with a collection containig two project object (where I expect only one)...

Are there any solutions to store a 'real' bidirectional relationship between to objects?

Thanks in advance,

Markus


-- 
Markus.Spaeth@mathema.de

MATHEMA Software GmbH
N�gelsbachstra�e 25b
91052 E r l a n g e n
Telefon 09131/8903-0
Telefax 09131/8903-55
http://www.mathema.de

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