I am looking for a way in EclipseLink to have two @DiscriminatorColumns on the same entity
Table of my PostreSQL DB:
Dictionary
{
id,
object_type,
attribute_type,
translation
}
And classes:
@Entity
@Table(name = "dictionary")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="object_type",
discriminatorType=DiscriminatorType.INTEGER)
public class DictionaryRow implements Serializable;
@Entity
@DiscriminatorValue("0")
@DiscriminatorColumn(name="info_type",
discriminatorType=DiscriminatorType.INTEGER)
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public class DictionaryAttribute extends DictionaryRow;
@Entity
@DiscriminatorValue("1")
public class DictionaryAttributeName extends DictionaryAttribute;
I am trying to ensure that when I call the word DictionaryAttributeName, it will be resolved as SQL:
select * from DICTIONARY where info_type = 1 and object_type = 0
But in fact, it takes the DiscriminatorColumn class from the DictionaryRow class and DiscriminatorValue from the AttributeName dictionary, which leads to completely incorrect SQL:
select * from DICTIONARY where object_type = 1
Is there a solution for this problem?
thank
source
share