Код: Выделить всё
@Entity(name="products")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="product_type",
discriminatorType = DiscriminatorType.INTEGER)
public abstract class Product {
// ...
}
< /code>
и < /p>
@Entity
@DiscriminatorValue("1")
public class Book extends Product {
// ...
}
< /code>
@Entity
@DiscriminatorValue("2")
public class EBook extends Product {
// ...
}
Код: Выделить всё
@Entity
public abstract class DigitalProduct extends Product {
// ...
}
Код: Выделить всё
@Entity
@DiscriminatorValue("2")
public class EBook extends DigitalProduct {
// ...
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... ngle-table