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


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 using extensions with current DataNucleus code.

  • Update DN code to cater for multiple columns (and values) for each class, and then provide a mechanism for getting class name from the column values. This is potentially a lot of work, and would have to retain compatibility with standard JDO / JPA handling.
  • Update your DB to only have a single (surrogate) column and use standard JDO discriminator handling.
  • Update your class(es) to map on to a single one of the (surrogate) columns and optionally read in the other column (if it is still important) into a field of the class(es).

Join to automatically receive all group messages.