Re: Use multiple columns for Discriminator in Inheritance Tree with single-table


Andy
 
Edited

Yes, JDO, JPA (and Jakarta Persistence) all allow 1 discriminator (value) only. JDO metadata strictly speaking permits multiple columns for some reason, but there is only space for 1 value and that's what DataNucleus has always stuck to. Multiple discriminator values makes little sense to me FWIW.

I don't see any way of having multiple discriminator columns by extending DataNucleus code. The strategy is simply how the value is defined.

If the table is already existing and you're simply trying to map to it then instead of having a discriminator column (surrogate) you could just add a field directly in your class(es) to map to that column, and thereafter on any queries, restrict that field value.

Join main@datanucleus.groups.io to automatically receive all group messages.