db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@jpox.org
Subject Associations with attributes/roles
Date Fri, 24 Feb 2006 10:00:52 GMT
An user sent us this, which might be a nice addition for a future JDO release.

An outline of his wish is 1-1 or 1-N associations with properties allowing to
distinguish from other associations to same types. A kind of discriminator at
field level.

Regards,
-------------
I have checked docs looking for examples but with no
success.
Recalling a typical example of a person with 2 addresses,
defined as distinct members of Person class,
I would map the Address class in a table with a FK to Person
and some extra (constant) column as discriminator.

class Person {
String name;
Address home;
Address work;
...
}

Address {
String street;
String city;

..
}

Table PERSON
-----------------
PERSON_ID
NAME

Table ADDRESS
-------------------
ADDRES_ID
STREET
CITY
PERSON_ID
ADDR_TYPE = {"HOME", "WORK"}

ADDR_TYPE values should be transparently managed by
JDO implementation

Is it possible with jpox standard/extensions ?
Is it possible for collections too (i.e. 2 addresses collections) ?

Guido

Mime
View raw message