org.hibernate.PropertyNotFoundException

时间:2010-05-19 11:02:14

标签: java hibernate

嗨,我是hibernate新手,我使用以下代码并收到以下错误

public class OperProfile {
private String empId;
 private long age;
 private String name;
public long getAge() {
  return age;
 }
 public void setAge(long age) {
  this.age = age;
 }
public String getEmpId() {
  return empId;
 }
 public void setEmpId(String empId) {
  this.empId = empId;
 }
 public String getName() {
  return name;
 }
 public void setName(String name) {
  this.name = name;
 }
}

我收到此错误

  

org.hibernate.PropertyNotFoundException:   无法找到适合年龄的吸气剂   class com.fmr.OperProfile

我的hbm.xml文件是

<hibernate-mapping>
 <class name="com.fmr.OperProfile" table="EMPLOYEE"
  dynamic-update="true">

  <id name="empId" type="java.lang.String" column="EMP_ID">
   <generator class="assigned" />
  </id>
  <property name="name" type="java.lang.String" column="NAME"/>
  <property name=" age" type="java.lang.Long" column="AGE" not-null="true" />
  <property name="address1" type="java.lang.String" column="ADDRESS1" />
  <property name="address2" type="java.lang.String" column="ADDRESS2" />
  <property name="city" type="java.lang.String" column="CITY" />
  <property name="state" type="java.lang.String" column="STATE" />
   <property name="pincode" type="java.lang.Long" column="PINCODE" />
 </class>
</hibernate-mapping>

请任何人帮助我

1 个答案:

答案 0 :(得分:6)

你的hbm文件中有一个恶意空间:

name=" age"

应该是

name="age"