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 Stefan Schlösser <ss...@intermediate.de> on 2003/12/15 11:53:52 UTC
Unusual object relation mapping possible with OJB ?
Hi,
I would like to know how to describe the following relations in the
repository.xml.
class Address{ //no reference to Person
static long type = 1;
long id;
String streetName;
}
class Link{ //links Persons and address by id and type
long sourcetype;
long sourceid;
long targettype;
long targetid;y
}
class Person{ //no reference to Address
static long type = 2;
long id;
String firstName;
}
I know how to map the individual classes but how do I describe a
relationship between Addresses and Persons ?
The relationship is defined such that it exists if a link with the
sourcetype=1, targettype=2 and the ids of the objects exists.
I don't want to retrieve Persons when loading addresses, hence no Person
or Address field referencing the other class exists - but be able to do
a query to retrieve all Persons with a specific streetName.
Is that possible with OJB ?
If not, how do I need to change the model to make it work ?
Also I do not wish to carry the type field in each object, is there a
way to get rid of it and specifiy it in the repository descriptor
directly (with the value) ?
Is there a solution which avoids putting references of one class into
the other ?
Thanks for any ideas.
Stefan Schlösser
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org