0
回答
Hibernate 注解配置问题
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   

/**商品分类一的一方*/
 private GoodsCategoryEntity goodsCategoryEntity ;

 /**商品分类一对多 */
 private Set<GoodsCategoryEntity> goodsCategoryEntitys = new HashSet<GoodsCategoryEntity>(0);
 

 /**
  *方法: 取得一的一方
  *@return : GoodsCategoryEntity
  */
 @ManyToOne(fetch = FetchType.LAZY)
 @JoinColumn(name = "parent_id")
 public GoodsCategoryEntity getGoodsCategoryEntity() {
  return goodsCategoryEntity;
 }

 /**
  *方法: 设置一的一方
  *@param: GoodsCategoryEntity goodsCategoryEntity
  */
 public void setGoodsCategoryEntity(GoodsCategoryEntity goodsCategoryEntity) {
  this.goodsCategoryEntity = goodsCategoryEntity;
 }

 

 

 /**
  *方法: 取得多的一方
  *@return : Set<GoodsCategoryEntity>  goodsCategoryEntitys
  */
 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "goodsCategoryEntity")
 public Set<GoodsCategoryEntity> getGoodsCategoryEntitys() {
  return goodsCategoryEntitys;
 }

 /**
  *方法: 设置goodsCategoryEntitys
  *@param: Set<GoodsCategoryEntity>  goodsCategoryEntitys
  */
 public void setGoodsCategoryEntitys(
   Set<GoodsCategoryEntity> goodsCategoryEntitys) {
  this.goodsCategoryEntitys = goodsCategoryEntitys;
 }
 

 

 

举报
顶部