I'm trying to implement a inheritence relationship between JPA entities.
Borrowing the example from: http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/jpa_overview_mapping_discrim.html
@Entity
@Table(name="SUB", schema="CNTRCT")
@DiscriminatorColumn(name="KIND", discriminatorType=DiscriminatorType.INTEGER)
public abstract class Subscription {
...
}
@Entity(name="Lifetime")
@DiscriminatorValue("2")
public class LifetimeSubscription
extends Subscription {
...
}
}
@Entity(name="Trial")
@DiscriminatorValue("3")
public class TrialSubscription
extends Subscription {
...
}
What I need to be able to do is have an additional entity that catches the rest, something like:
@Entity(name="WildCard")
@DiscriminatorValue(^[23])
public class WildSubscription
extends Subscription {
...
}
Where if it does not match LifetimeSubscription or TrialSubscription it will match WildSubscription. It actually makes a bit more sense if you think of it where the wild is the superclass, and if there is not a more concrete implementation that fits, use the superclass.
Anyone know of a method of doing this?
Thanks!