у меня есть 2 таблицы MYSQLHibernate вложенная дискриминатор на унаследованных классов
table1
id bigint auto increment Primary Key
type Enum ('vegetable','fruit')
color Enum ('green','red','yellow')
table2
id bigint (same as the id in Table 1)
sweet boolean
sour boolean
.. other fields specific to type fruit
Теперь я создаю 3 объекта, первый родительский класс
@Entity
@Configurable
@Table(name = "table1")
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING)
public class ParentClass {
..
}
Теперь второй класс для овощей
@Entity
@Configurable
@DiscriminatorValue("vegetable")
@DiscriminatorColumn(name = "color", discriminatorType = DiscriminatorType.STRING)
public class Vegetable extends Parent{
..
}
И в-третьих, класс фрукты
@Entity
@Configurable
@SecondaryTables({ @SecondaryTable(name = "table2",
pkJoinColumns = { @PrimaryKeyJoinColumn(name = "id", referencedColumnName = "id") }) })
@DiscriminatorValue("fruit")
@DiscriminatorColumn(name = "color", discriminatorType = DiscriminatorType.STRING)
public class Fruit extends Parent{
..
}
Я нуждаясь второй дискриминатор, чтобы добавить дополнительные наследуемые классы (6 дополнительных классов) на растительном и Fruit like,
и так далее.
Hibernate не позволяет мне сделать это. Что случилось с моим дизайном? Заранее спасибо!