hibernate pojo setter method problem

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

Hi Friend,

Please visit the following link:

Hibernate Tutorials

Thanks









Related Tutorials/Questions & Answers:
hibernate pojo setter method problem
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...: The method setEmpDob(Date) in the type Employee is not applicable for the arguments (int
Hibernate create POJO classes
Hibernate 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 problem
pojo 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
pojo generation - Hibernate
pojo generation  Can we create a pojo from a data of two different tables
problem related to onSubmit() method
problem 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 - Hibernate
Hibernate 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 problem
hibernate 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 - Hibernate
Hibernate 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
please let me get code how to insert a data to mysql using setter and getter method by using java
please let me get code how to insert a data to mysql using setter and getter method by using java  please let me get code how to insert a data to mysql using setter and getter method by using java pelease let me have the code
please let me get code how to insert a data to mysql using setter and getter method by using java
please let me get code how to insert a data to mysql using setter and getter method by using java  please let me get code how to insert a data to mysql using setter and getter method by using java pelease let me have the code
hibernate code problem - Hibernate
hibernate 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 - Hibernate
Hibernate code problem  how to write hibernate Left outer join program
delete() method of hibernate
delete() method of hibernate  Define the use of delete() method of hibernate? Example
Hibernate code problem - Hibernate
Hibernate 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 problem
Eclipse 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 - Hibernate
hibernate 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 - Hibernate
hibernate 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 11g
Problem 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 Method
Hibernate 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 Method
Hibernate 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 - Hibernate
Problem 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 Method
Hibernate 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
Maven Repository/Dependency: org.hibernate.search | hibernate-search-mapper-pojo
Maven Repository/Dependency of Group ID org.hibernate.search and Artifact ID hibernate-search-mapper-pojo. Latest version of org.hibernate.search:hibernate-search-mapper-pojo dependencies. # Version Release
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 - Hibernate
Problem 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() method
Hibernate 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 - Hibernate
server 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 problem
hibernate 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 - Hibernate
Hibernate @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
org.hibernate.search - hibernate-search-mapper-pojo-base version 6.2.0.CR1 Maven dependency. How to use hibernate-search-mapper-pojo-base version 6.2.0.CR1 in pom.xml?
org.hibernate.search  - Version 6.2.0.CR1 of hibernate-search-mapper-pojo... 6.2.0.CR1 of hibernate-search-mapper-pojo-base in pom.xml? How to use hibernate...; - Version 6.2.0.CR1 of hibernate-search-mapper-pojo-base in project by the help
Java Compilation error. Hibernate code problem. Struts first example - Hibernate
Java Compilation error. Hibernate code problem. Struts first example  Java Compilation error. Hibernate code problem. Struts first example
Problem in running first hibernate program.... - Hibernate
Problem in running first hibernate program....  Hi...I am using... programs.It worked fine.To run a hibernate sample program,I followed the tutorial below and installed the hibernate tools succuccfully. http://www.roseindia.net
Maven Repository/Dependency: org.hibernate.search | hibernate-search-mapper-pojo-base
Maven Repository/Dependency of Group ID org.hibernate.search and Artifact ID hibernate-search-mapper-pojo-base. Latest version of org.hibernate.search:hibernate-search-mapper-pojo-base dependencies. # Version
How does getcurrentsession() method works in hibernate sessionfactory?
How does getcurrentsession() method works in hibernate sessionfactory?  Hi, Please explain how does getcurrentsession() method works in hibernate... about getCurrentSession() method in Hibernate sessionfactory Also you can read
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.1.6.Final is released. Learn to use hibernate-search-mapper-pojo-base version 6.1.6.Final in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.1.6.Final.
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.1.7.Final is released. Learn to use hibernate-search-mapper-pojo-base version 6.1.7.Final in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.1.7.Final.
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.0.10.Final is released. Learn to use hibernate-search-mapper-pojo-base version 6.0.10.Final in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.0.10.Final.
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.2.0.Alpha1 is released. Learn to use hibernate-search-mapper-pojo-base version 6.2.0.Alpha1 in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.2.0.Alpha1.
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.0.9.Final is released. Learn to use hibernate-search-mapper-pojo-base version 6.0.9.Final in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.0.9.Final.
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.0.8.Final is released. Learn to use hibernate-search-mapper-pojo-base version 6.0.8.Final in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.0.8.Final.
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.1.5.Final is released. Learn to use hibernate-search-mapper-pojo-base version 6.1.5.Final in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.1.5.Final.
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.1.4.Final is released. Learn to use hibernate-search-mapper-pojo-base version 6.1.4.Final in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.1.4.Final.
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.1.3.Final is released. Learn to use hibernate-search-mapper-pojo-base version 6.1.3.Final in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.1.3.Final.
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.1.2.Final is released. Learn to use hibernate-search-mapper-pojo-base version 6.1.2.Final in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.1.2.Final.
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.1.1.Final is released. Learn to use hibernate-search-mapper-pojo-base version 6.1.1.Final in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.1.1.Final.
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.1.0.Final is released. Learn to use hibernate-search-mapper-pojo-base version 6.1.0.Final in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.1.0.Final.
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.1.0.CR1 is released. Learn to use hibernate-search-mapper-pojo-base version 6.1.0.CR1 in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.1.0.CR1.
Maven dependency for org.hibernate.search - hibernate-search-mapper-pojo-base version 6.1.0.Beta2 is released. Learn to use hibernate-search-mapper-pojo-base version 6.1.0.Beta2 in Maven based Java projects
of hibernate-search-mapper-pojo-base released The developers of   org.hibernate.search - hibernate-search-mapper-pojo-base project have released...; org.hibernate.search - hibernate-search-mapper-pojo-base library is 6.1.0.Beta2.

Ads