
how to pass a date type variable to a setter method in hibernate pojo class? //this is my pojo class
import java.util.*; public class Employee { private String empname; private int empcode; private int empsal; private Date empDob; private Date empDoa; public String getEmpname() { return empname; } public void setEmpname(String empname) { this.empname = empname; } public int getEmpcode() { return empcode; } public void setEmpcode(int empcode) { this.empcode = empcode; } public int getEmpsal() { return empsal; } public void setEmpsal(int empsal) { this.empsal = empsal; } public Date getEmpDob() { return empDob; } public void setEmpDob(Date empDob) { this.empDob = empDob; } public Date getEmpDoa() { return empDoa; } public void setEmpDoa(Date empDoa) { this.empDoa = empDoa; }
}
//this is my client class code
import org.hibernate.*; import org.hibernate.cfg.*; public class Client { public static void main(String args[]) { Session session=new Configuration().configure().buildSessionFactory().openSession(); Employee e = new Employee();
e.setEmpname("Praveena");
e.setEmpcode(1001);
e.setEmpsal(10000);
e.setEmpDob(1988-09-12);
e.setEmpDoa(2010-11-01);
Transaction tx=session.beginTransaction();
session.save(e);
tx.commit();
session.close();
}
}
//along with them I have cfg and hbm files , and I am getting this Exeception
Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method setEmpDob(Date) in the type Employee is not applicable for the arguments (int) The literal 09 of type int is out of range The method setEmpDoa(Date) in the type Employee is not applicable for the arguments (int)
at Client.main(Client.java:13)
CAN ANYONE HELP ME ??????
THANKS IN ADVANCE

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.