日期:2014-05-17 浏览次数:20782 次
@Entity
public class Spaces {
// 所属人
private Owner owner; // id name ...等属性。
@OneToOne(fetch=FetchType.EAGER)
public Owner getOwner() {
return owner;
}
public void setOwner(Owner owner) {
this.owner = owner;
}
}
List<Spaces> list=session.createQuery("from Spaces").list();
function(list){
$.each(list,function(i,n){
//n.owner.name error: Cannot read property 'name' of null
})
}