我的eclipse编辑器中出现此错误此类具有复合主键。它必须使用ID类。,但该类没有复合主键,因为id是Long
@SuppressWarnings("serial")
@Entity
@Table(name = "T_PRODUCT")
@SequenceGenerator(name = "seqPRODUCT", sequenceName = "SEQ_PRODUCT")
public class Product extends ItemBase implements java.io.Serializable {
@Id
private Long id;
@Id
@Column(name = "ID", unique = true, nullable = false, precision = 38, scale = 0)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqPRODUCT")
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
..
}
答案 0 :(得分:3)
Hibernate在属性和getter方法上都看到了两个注释,因此假定您正在使用复合键。