hibernate pojo setter method problem
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
View Answers
November 23, 2010 at 10:54 AM
Related Tutorials/Questions & Answers:
hibernate pojo setter method problemhibernate pojo setter method problem how to pass a date type variable to a
setter method in
hibernate pojo class?
//this is my
pojo class
import...:
The
method setEmpDob(Date) in the type Employee is not applicable for the arguments (int
Hibernate create POJO classesHibernate create
POJO classes
In this tutorial you will learn how to create a
POJO class in
Hibernate.
POJO (Plain Old Java Object) is a programming model... be avoidable because
hibernate's feature
proxies depends upon the
POJO Advertisements
pojo class having problempojo class having problem Cannot find any information on property 'Username' in a bean of type 'LoginBean.LoginBeanClass'
org.apache.jasper.runtime.JspRuntimeLibrary.handleSetProperty(JspRuntimeLibrary.java:664
problem related to onSubmit() methodproblem related to onSubmit() method Hello,
I am developing application.when i submit form at that time formBacking()
method is call...Instead of that
onSubmit() should have to call
....
please help me
Hibernate code problem - HibernateHibernate code problem Hi,
This is Birendra Pradhan.I want... & Regards
Birendra Hi friend,
For solving the
problem visit to :
http://www.roseindia.net/
hibernate/index.shtml
Thanks
hibernate problemhibernate problem please help me....
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please...:12)
i am getting this prob while running my
hibernate program in Eclips
please
Hibernate code problem - HibernateHibernate code problem Hi
This is Raju.I tried the first example of
Hibernate material what u have given.
I have written contact.java... session.flush();
i am using
hibernate 3.3.1 and I kept hibernate3.jar
hibernate code problem - Hibernatehibernate code problem suppose i want to fetch a row from the table... . Please visit for more information.
http://www.roseindia.net/
hibernate/selectclause.shtml
If you have any
problem this send me detail and source code
Hibernate code problem - HibernateHibernate code problem
Hi This is Raju
I tried the first example of
hibernate course material.This is to insert a record into CONTACT table.Is
Hibernate code automatically creates the CONTACT table and then insert
Eclipse hibernate problemEclipse
hibernate problem hie..i've just started a basic
hibernate... and created a
pojo class.
I have created HibernateUtil class but I'm getting...;
Hibernate Eclipse Integration
Hibernate Tutorials
hibernate code problem - Hibernatehibernate code problem String SQL_QUERY =" from Insurance...: "
+ insurance. getInsuranceName());
}
in the above code,the
hibernate...= request.getParameter("name");
For more information on
hibernate visit to :
http
hibernate insertion problem - Hibernatehibernate insertion problem Hi ,
Thanks for the material .Its very gud .
when i run FirstExample.java i get the message insertion has been done int the table contact . but whne i look into database data is not inserted
Hibernate code problem - Hibernate Hibernate code problem Hai, iam working on simple login application using
hibernate in spring.
I've used Spring dependency injection too.I struck at DAO(data access Object)layer while executing the select statement in HQL
Problem with Hibernate or 11gProblem with
Hibernate or 11g Hi
I am using
Hibernate and 11g in my project.
The
problem I am facing is I am executing a query from java class... on Created date column by using
hibernate query language.
The
Problem is every
Hibernate saveOrUpdate MethodHibernate saveOrUpdate
Method
In this tutorial you will learn about the saveOrUpdate
method in
Hibernate.
Hibernate's saveOrUpdate
method inserts the new... saveOrUpdate()
method
can be used in
Hibernate. For this I am giving a complete
Hibernate update MethodHibernate update
Method
In this tutorial you will learn about the update
method in
Hibernate
Hibernate's update
method saves the modified value... will use an update
method of
Hibernate to update the record of table.
Complete
Problem in updating query in Hibernate - HibernateProblem in updating query in Hibernate Hi,
I have used a query to update the existing columns of one table. The query updates the records...,
Please visit the following link:
http://www.roseindia.net/
hibernate Hibernate persist MethodHibernate persist
Method
In this tutorial you will learn about how to use persist
method in
hibernate.
Hibernate's persist()
method is used to insert... (primary key)
value that is generated by the
hibernate but the persist()
method Use of delete() method in hibernate.Use of delete()
method in
hibernate. Define the use of delete()
method of
hibernate?
Hibernate provide the facility to delete one row...(object);
transaction.commit();
}
}
Output:
Hibernate: select
delete query problem - Hibernate correctly , the
problem is only delete query.
2) query.executeUpate(); ->...();
Read for more information.
http://www.roseindia.net/
hibernate
Thanks
Problem with open connection - HibernateProblem with open connection Hi Team,
I am running one
hibernate application and the database is ORACLE 10g.I am getting the below error.I connected to the database by using JDBC(with same driver and url).Please tell me
Hibernate session.refresh() methodHibernate session.refresh() method What is session.refresh() in
hibernate?
It is possible to re-load an object and all its collections at any time, using the refresh()
method. This is useful
when database triggers
server problem - Hibernateserver problem dear sir please give me best soloution how run
hibernate and spring application on jboss and weblogic10.1.0 sever and compile
thanks
hibernate update problemhibernate update problem HI,
I integrated the struts and
hibernate and wrote the following query in the databean to update the user table login time
SessionFactory sessionFactory = (SessionFactory)context.getAttribute
Hibernate @ManyToOne persisting problem - HibernateHibernate @ManyToOne persisting problem hello,
In my apllication, there are students and classes. a student can take many classes. So there is OneToMany <--> ManyToOne relationship. Im my case, the best implementation