Is there any way to map this elegantly in JPA
No, not that I know of. If the problem is caused on the data layer (i.e. data or database) I'd try to solve it on that layer. Try either of the two below approaches:
- create a view in the database that is identical to the table except that "anything not specified elsewhere" is mapped* to the default discriminator
- write an on-insert/update trigger on the
Product
table that fixes the discriminator values of each reacord*.
*Oracle for example provides DECODE to map values from range A to range B if-then-else-like.