<hibernate-mapping package="com.itcast.f_hbm_oneToMany">
<class name="Department" table="department"> <!--generator主键生成策略 -->
<id name="id">
<generator class="native" />
</id>
<property name="name" />
<set name="employees">
<key column="departmentID"></key>
<one-to-many class="Employee"/>
</set>

</class>
</hibernate-mapping>

由于上面这个映射文件里我employees少写了s,造成了错误。映射文件里的属性是跟实体Department里的属性是一一对应的。实体Department如下:

public class Department {
private Integer id;
private String name; private Set<Employee> employees = new HashSet<Employee>(); // 关联的很多员工 public Integer getId() {
return id;
} public void setId(Integer id) {
this.id = id;
} public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public Set<Employee> getEmployees() {
return employees;
} public void setEmployees(Set<Employee> employees) {
this.employees = employees;
} @Override
public String toString() {
return "[Department: id=" + id + ", name=" + name + "]";
} }

org.hibernate.PropertyNotFoundException: Could not find a getter for employee in class com.itcast.f_hbm_oneToMany.Department的更多相关文章

  1. org.hibernate.PropertyNotFoundException:could not find a getter for name in class ....

    Hibernate创建持久化类须符合JavaBean的规范,"get","set"后面紧跟属性的名字,并且属性名的首字母为大写.如果不遵守这个规则,Hibern ...

  2. hibernate异常找不到get方法org.hibernate.PropertyNotFoundException: Could not find a getter for did in class com.javakc.hibernate.manytomany.entity.CourseEntity

    属性的get方法没找到,可能是CourseEntity类中对应属性没有get方法,如果有就看CourseEntity.hbm.xml属性名称,应该是写错了不和CourseEntity类中属性名相同,修 ...

  3. hibernate出现 org.hibernate.PropertyNotFoundException: field [departmen] not found on cn.itcast.hibernate.domain.Employee1错误

    hibernate出现 org.hibernate.PropertyNotFoundException: field [departmen] not found on cn.itcast.hibern ...

  4. SSH面试题(struts2+Spring+hibernate)

    struts2 + Spring +hibernate Hibernate工作原理及为什么要用?   原理:   1.读取并解析配置文件   2.读取并解析映射信息,创建SessionFactory ...

  5. 【转】Hibernate 常见异常

    转载地址:http://smartan.iteye.com/blog/1542137 Hibernate 常见异常net.sf.hibernate.MappingException        当出 ...

  6. Could not find a getter for orderItems in class

    ::, ERROR ContextLoader: - Context initialization failed org.springframework.beans.factory.BeanCreat ...

  7. Hibernate 常见异常

    Hibernate 常见异常net.sf.hibernate.MappingException        当出现net.sf.hibernate.MappingException: Error r ...

  8. Hibernate常见错误整理

    Hibernate常见错误合集   1.错误:object references an unsaved transient instance - save the transient instance ...

  9. Hibernate——hibernate的配置测试

    Hibernate Hibernate是一个开放源代码的对象关系映射框架,它对JDBC进行了非常轻量级的对象封装,它将POJO与数据库表建立映射关系,是一个全自动的orm框架,hibernate可以自 ...

随机推荐

  1. sublime修改代码字体颜色

    1.首先知道你采用的是什么颜色主题在Preferences => color scheme查看,假设是Monokai2.查找该主题的脚本文件Preferences => Browse Pa ...

  2. xss框架的一些想法

    今天pybeef作为一个课程设计答辩完成了,向老师介绍了很多xss利用相关的场景和技术. 先说一下已经实现了什么, 1, 浏览器版本的判断 这方面只能判断IE和firefox 火狐判断只判断了user ...

  3. ListView上下线添加

    <com.jclick.swipelistview.byzswipemenulistview.InScrollviewSwipeMenuListView android:id="@+i ...

  4. Java反序列化漏洞分析

    相关学习资料 http://www.freebuf.com/vuls/90840.html https://security.tencent.com/index.php/blog/msg/97 htt ...

  5. linux下文件搜索

    常用: grep -nr "关键字" 搜索当前目录下所有匹配关键字的文件 grep -nr "关键字" *php  搜索当前目录下所有匹配关键字的php文件 f ...

  6. iOS开发QQ空间半透明效果的实现

    //1.首先我们可以确定的是cell的半透明, /* white The grayscale value of the color object, specified as a value from ...

  7. 2016年团体程序设计天梯赛-决赛 L1-1. 正整数A+B(15)

    本题的目标很简单,就是求两个正整数A和B的和,其中A和B都在区间[1,1000].稍微有点麻烦的是,输入并不保证是两个正整数. 输入格式: 输入在一行给出A和B,其间以空格分开.问题是A和B不一定是满 ...

  8. sql 取2个日期之间的数据

    select * from table1 where larq between(to_date('2008-9-3','yyyy-mm-dd')) and (to_date('2008-9-5','y ...

  9. 关于Axis 1.4 环境的搭建问题

    本来很简单的一个环境搭建问题足足困扰了我一周的时间,所以思来想去还是写一篇博文记录下来,以后就不用那么四处去找资料找例子了,实在是浪费时间 废话不多说 1  首先在MyEclipse下创建WEB PR ...

  10. [ An Ac a Day ^_^ ] FZU 2030 括号问题 搜索

    FZU一直交不上去 先写在这吧 #include<stdio.h> #include<iostream> #include<algorithm> #include& ...