嗨,我有以下型号:如何解决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