OneToMany ManyToOne

public class Perspective{
@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
  @JoinColumn(name="perspectiveId")
public List<PersistView> getViews() {
return views;
}
}

public class PersistView{
private int perspectiveId;
}


OneToMany,其中的One指的是当前class,即Perspective,而Many是target entity,这里是PersistView,即One Perspective 对应many PersistView

你可能感兴趣的:(OneToMany,ManyToOne)