zmjmvp
zmjmvp
采纳率0%
2016-01-17 12:21 阅读 1.3k

关于hibernate的配置命名问题求解答

一直报org.hibernate.PropertyNotFoundException: Could not find a getter for name in class cn.zmj.bean.Service

我感觉我的命名并没有错

User.hbm.xml:

 <set name="service" cascade="all" lazy="true">
<key column="user"></key>
<one-to-many class="Service" />
</set>


<set name="manage" cascade="all" lazy="true">
<key column="manage"></key>
<one-to-many class="Service" />
</set>




User:


private Set<Service> service = new HashSet<Service>();
private Set<Service> manage = new HashSet<Service>();


public Set<Service> getService() {
return service;
}
public void setService(Set<Service> service) {
this.service = service;
}
public Set<Service> getManage() {
return manage;
}
public void setManage(Set<Service> manage) {
this.manage = manage;
}




Service.hbm.xml:


<many-to-one name="user" class="User" column="user"></many-to-one>


<many-to-one name="manage" class="User" column="manage"></many-to-one>


Service:


private User user;
private User manage;


public User getManage() {
return manage;
}
public void setManage(User manage) {
this.manage = manage;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

相关推荐