两张包含父子实用船的表
private List<Favorites> favorites= new ArrayList<Favorites>();
public String getAccFav() {
return accFav;
}
public void setAccFav(String accFav) {
this.accFav = accFav;
}
@OneToMany(fetch = FetchType.EAGER, mappedBy = "activities" )
public List<Favorites> getFavorites() {
return favorites;
}
Child
@ManyToOne(fetch = FetchType.EAGER )
@JoinColumn(name = "ACTIVITYID", nullable = false)
public Activities getActivities() {
return this.activities;
}
我想显示父级中的所有记录以及子级中的常见记录。如下所示的东西
SELECT * FROM activities a left OUTER JOIN favorites f
ON a.activityid = f.activityid
使用Hibernate我收到错误。
activities = session.createQuery("from Activities a left outer join Favorites f on where a.activity_id=f.activityid").list();
我该怎么做?