我有两个类映射 OneToMany、ManyToOne,但我得到了异常:
org.hibernate.AnnotationException:mappedBy 引用了一个未知的目标实体属性:entity_package.UserEntity.ownedTickets 中的 entity_package.TicketEntity.ownerEntity
这是代码:
公共类 UserEntity 实现 Serializable {
@OneToMany(mappedBy="ownerEntity")
public List<TicketEntity> getOwnedTickets() {
return tickets;
}
public void setOwnedTickets(List<TicketEntity> tickets) {
this.tickets = tickets;
}
和 ...
公共类 TicketEntity 实现 Serializable {
private UserEntity ownerEntity;
@ManyToOne
@JoinColumn(name="owner_id")
public UserEntity getOwner() {
return ownerEntity;
}
public void setOwner(UserEntity owner) {
this.ownerEntity = owner;
}
怎么了 ?