db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Jefferson <a...@datanucleus.org>
Subject Handling inheritance in embedded PC objects?
Date Mon, 21 Nov 2011 11:49:16 GMT
While the JDO2 spec introduced being able to specify a 1-1 relation as having 
the related object as embedded, it doesn't appear to handle how to persist 
inherited embedded objects.

public class A {
    @Embedded
    B b;
}

public class B {...}
public class C extends B {...}

So we embed an object, that may be a B or may be a C. Obviously, thinking in 
an RDBMS context, it would be desirable to have a discriminator column stored 
for the "b" field so we can extract the right type when reading it. The only 
problem is that <embedded> doesn't allow specification of such a thing 
(obviously we could default to some column name, but would be nice to specify 
it). I'd propose adding <discriminator> as a subelement of <embedded> so 
column name etc can be defined (and something equivalent for annotations).

Comments?



-- 
Andy
DataNucleus (http://www.datanucleus.org)

Mime
View raw message