Hi,

In a single table inheritance strategy, would it be possible to use any
additional JPA mapping to define a discriminator strategy that will get
discriminator values in a different table ?


For example, from the given database schema and classes :



create table A (
   ID integer primary key not null,
   ...
   DISCR varchar,
) ;

@Entity
@Table(name = "A")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "DISCR", discriminatorType =
DiscriminatorType.STRING)
public abstract class A {
    ...
}

@Entity
@DiscriminatorValue("foo")
public class B extends A {
    ...
}


if the database schema changes a little,


create table A (
   ID integer primary key not null,
   ...
   DISCR integer,
) ;

create table DISCRIMINATOR (
   ID integer primary key not null,
   ...
   VALUE varchar
) ;


would it be possible to change the DiscriminatorColumn annotation in the A
class to search for the discriminator value in DISCRIMINATOR.VALUE instead
of A.DISCR, assuming that A.DISCR will no longer contain string data but
DISCRIMATOR primary key ?

Thank you for your idea.
-- 
View this message in context: 
http://n2.nabble.com/Single-table-discriminator-strategies-tp4510595p4510595.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to