在主键类添加implements Serializable
表中如果有多个主键:
@Entity
@IdClass(TestPK.class)
@Table(name = "test")
public class TestEntity{
@Id
@Column(name = "a")
private int a;
@Id
@Column(name = "b")
private int b;
}
public class TestPK implements Serializable {
private int a;
private int b;
public TestPK() {
}
@Override
public int hashCode() {
,,,
}
@Override
public boolean equals(Object obj) {
,,,
}
}
posted on 2019-08-24 16:25
小王 阅读(976)
评论(0) 编辑 收藏 引用 所属分类:
JPA