首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

hibinet的递归兑现

2012-08-28 
hibinet的递归实现;hibinet的递归实现 首先 自身public class Myclass{private int idprivate String nam

hibinet的递归实现;
hibinet的递归实现
首先 自身

public class Myclass{
 
private int id;
private String name;

private set<Myclass> Chlidren;


private Myclass parente;

@ManyToOne(fetch = FetchType.LAZY )
public void setParente(Myclass parente){
   this.parent=parente
}
@oneToMany(fetch = FetchType.LAZY.mappeBy="Myclass")
public void setClidren(set<Myclass> Chlidren){

   this.Chlidren=Chlidren;

}

随便了解下mappedBy属性
a) 只有OneToOne,OneToMany,ManyToMany上才有mappedBy属性,ManyToOne不存在该属性;
b) mappedBy标签一定是定义在the owned side(被拥有方的),他指向the owning side(拥有方);
c) mappedBy的含义,应该理解为,拥有方能够自动维护跟被拥有方的关系;


}

热点排行