我有想要覆盖实体子类中的 AttributeConverter 的问题,但子类中定义的转换器没有被调用。根据 AttributeConverter 文档,这应该是这样,但它对我不起作用。我究竟做错了什么?
@Entity
@org.hibernate.annotations.DynamicUpdate(value = true)
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "DISCRIMINATOR", discriminatorType = DiscriminatorType.STRING)
@DiscriminatorValue("ORDER")
public class Order implements Serializable
{
...
@Column(name = "PRODUCT_SERIALIZED", updatable = false)
@Convert(converter = ProductConverter.class)
protected Product product;
...
}
@Entity
@DiscriminatorValue("CUSTOMER_ORDER")
@Convert(attributeName = "product", converter = CustomerProductConverter.class)
public class CustomerOrder extends Order
{
...