I am getting exception : org.hibernate.AnnotationException: No identifier specified for entity
I know that hibernate must have @Id in an entity class but in my table there are no primary keys just two foreign keys. How do i map the hibernate entity class without errors?
For example the class.
@Entity
@Table(name="building_block")
public class BuildingBlock implements Serializable {
private Integer archId;
private Integer mirrorId; //foreign key to Mirror table
private Integer makeId; //foreign key to Maker table
private Integer sweepId;
private String search;
private Integer length;
private Date createDate;
@Column(name="arch_id")
public Integer getArchId() {
return ArchId;
}
public void setArchId(Integer ArchId) {
this.ArchId = ArchId;
}
@Column(name="mirror_id")
public Integer getMirrorId() {
return mirrorId;
}
public void setMirrorId(Integer mirrorId) {
this.mirrorId = mirrorId;
}
@Column(name="make_id")
public Integer getMakeId() {
return makeId;
}
public void setMakeId(Integer makeId) {
this.makeId = makeId;
}
...
@Column(name="create_date")
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
}