db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@jpox.org
Subject Re: Issue 145: Mapping Map with embedded PersistenceCapable
Date Mon, 21 Nov 2005 22:24:56 GMT
Abe,

Check the below example

Owner owner = new Owner("Ted");
owner.add(new Dog("one"));
owner.add(new Dog("two"));

TABLE OWNER
ID NAME
1 Ted

TABLE OWNER_DOG
OWNER_ID NAME
1 one
1 two

If owner_id is primary key and nothing else, we will not be able to store more
than one instance of Dog for each owner. Thus, we need a new column to be part
of the primary key.

TABLE OWNER_DOG
OWNER_ID UNIQUENESS_ID NAME
1 1 one
1 2 two


Adding one more column will help if we dont have duplicates, but with duplicates
we need 3 columns.

Example

Owner owner = new Owner("Ted");
Dog one = new Dog("one");
Dog two = new Dog("two");

owner.add(one);
owner.add(one);
owner.add(two);

The only way I can think it to work is with the following schema

TABLE OWNER
ID NAME
1 Ted

TABLE OWNER_DOG
OWNER_ID UNIQUENESS_ID EMBEDDED_ID NAME
1 1 1 one
1 2 1 one
1 3 2 two



Quoting Abe White <awhite@bea.com>:

> > The issue came up with the TCK where we were trying to get JPOX to
> > recognize that an embedded PersistenceCapable in a join table can
> > have a unique identifying field. In the case of datastore identity,
> > this doesn't work because there is no primary key field in the
> > PersistenceCapable.
> >
> > <proposed 18.14>
> > A portable mapping for arrays, collections, and maps will include a
> > primary key on the join table.
> > </proposed 18.14>
>
> Why?  I don't understand this at all.  "Datastore identity" is
> meaningless in this context, as embedded objects have no identity
> according to the spec.
>




Mime
View raw message