假设您有这样的@Embeddable
映射:
@Embeddable
public class Wheel {
@Column(name = "COLOR")
@Type(type = "my.package.ColorUserType")
private Color theColor;
}
你尝试像这样使用它:
@Entity
@Table(name = "CAR")
public class Car {
@Embedded
@AttributeOverride(
column = @Column(name = "STEERING_WHEEL_COLOR")
name = "theColor"
)
private Wheel steeringWheel;
}
当我这样做时,我会org.hibernate.MappingException: Could not determine type for: my.package.Color
在启动时获得巨大的脂肪。
那么有没有办法覆盖类型或确保它使用定义的类型,@Embeddable
因为在使用时它显然没有被保留@AttributeOverride
?