如何向映射添加属性?

时间:2014-11-06 16:41:02

标签: java hibernate

我通过以下方式使用@MappedSuperclass注释:

@MappedSuperclass
public abstract class Recipient {
    @Id
    @Column(name = "id")
    private int id;

    @Column(name = "email")
    private String email;

    //GET, SET
}

我还有两个实体classe,继承自一个:

public class Player extends Recipient{
    //FIELD, GET, SET
}

public class Partner extends Recipient{
    //FIELD, GET, SET
}

private int id中提到的class Player具有附加属性:

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;

是否可以指定?我们可以使用注释@AttributeOverride覆盖属性,但是要添加一个?

0 个答案:

没有答案