tags:

views:

32

answers:

1

hi i am new to hibernate, i m using the following code and getting the following error

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;
 }
}

i am getting this error

org.hibernate.PropertyNotFoundException: Could not find a getter for age in class com.fmr.OperProfile

my hbm.xml file is

<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>

please can anyone help me

+4  A: 

You have a rogue space in your hbm file:

name=" age"

It should be

name="age"
skaffman
and you'd think it's bleeding obvious :)
JoseK