嗨,我有以下型號:如何解決hibernate錯誤:在實體映射中重複列?
@Entity
class Flight{
private Airport airportFrom;
private Airport airportTo;
@OneToOne(fetch=FetchType.LAZY,optional=false)
public Airport getAirportFrom(){
return this.airportFrom;
}
@OneToOne(fetch=FetchType.LAZY,optional=false)
public Airport getAirportTo(){
return this.airportTo;
}
}
@Entity
class Airport{
private Integer airportId;
@Id
public Integer getAirportId(){
this.airportId;
}
}
而且我得到這個錯誤:
org.hibernate.MappingException: Repeated column in mapping for entity: model.entities.Flight column: airportId (should be mapped with insert="false" update="false")
我已經嘗試過在每添加@Column(name = 「airportFrom)和@Column(name =」 機場至「)@ OneToOne,但我得到這個錯誤:「@oncolon(s)不允許在@onetoone財產」 – Neuquino 2010-11-20 21:34:31