Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Hibernate hibernate pojo setter method problem

Have Programming Question? Ask it here!
 
 
 


Praveena Naregudem
hibernate pojo setter method problem
1 Answer(s)      3 years and 9 months ago
Posted in : Hibernate


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


Advertisement
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...: Unresolved compilation problems: The method setEmpDob(Date) in the type
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 generation - Hibernate
pojo generation  Can we create a pojo from a data of two different tables
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
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 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
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 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  how to write hibernate Left outer join program
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
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  String SQL_QUERY =" from Insurance...: " + insurance. getInsuranceName()); } in the above code,the hibernate...= request.getParameter("name"); For more information on hibernate visit to : http
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  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
delete() method of hibernate
delete() method of hibernate  Define the use of delete() method of hibernate? Example
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 saveOrUpdate Method
Hibernate saveOrUpdate Method In this tutorial you will learn about the saveOrUpdate method in Hibernate. Hibernate's saveOrUpdate method inserts the new...() method can be used in Hibernate. For this I am giving a complete source code
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... an update method of Hibernate to update the record of table. Complete Code
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
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
Setter injection in Spring
Setter injection in Spring  What is Setter injection in Spring ?   The Spring IoC container supports setter injection, which is the preferred method of dependency injection in Spring. Setter injection uses the set
Pojo and java beans
Pojo and java beans  Can anyone tell me where we should use pojo class and where we should use beans. We use pojo class to make the object of mapping file in hibernate framework. Can I use pojo class in those applications where
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
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
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
delete query problem - Hibernate
correctly , the problem is only delete query. 2) query.executeUpate(); ->...(); Read for more information. http://www.roseindia.net/hibernate Thanks
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
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
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
Diff Bn Actionform and Pojo - Struts
Diff Bn Actionform and Pojo   Hi Friends, I am confused with Pojo and ActionForm ,bcoz both have getter and setter methods.In both we declare fields and corresponding getter n setters also.plz  
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
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
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
what is the use of Hibernate Sessionfactory close() method?
what is the use of Hibernate Sessionfactory close() method?  hi, What is the use of of Hibernate Sessionfactory close() method? Thanks..   Hello, Close() method of Hibernate Sessionfactory destroys the SessionFactory
Calling hibernate query list() method generates errors
Calling hibernate query list() method generates errors  Hello, I'm trying to debug someone's codes. But I am not an expert of hibernate so I'm... the database, but there seems to be a problem. In the entity class: //JobEntity
Webservices(Axis2 + tomcat ) Consuming Hibernate Giving Problem - Hibernate
Webservices(Axis2 + tomcat ) Consuming Hibernate Giving Problem  Hi Please tell me how can i integrate hibernate in axis2 for my webservice?? I tried in some ways..but its not working..Main problem is hibernate session
Hibernate Annotations
Hibernate Annotations       You have already familiar with hibernate so, here you will learn only the Hibernate Annotations part.  Download Source Code Hibernate Annotations: Hibernate needs
Why setter and getter methods - Development process
Why setter and getter methods  Every field has setter and getter... and setter methods are used to retrieve and manipulate private variables in a different class. The getter methods retrieves the attribute of the same name and setter
Spring Setter Injection
Basic Setter Injection Here in this example you will see another different type of injection known as setter injection which is the preferred method dependency injection in Spring. The convention of writing the setter method
I am having problem with configuring Hibernate sessionfactory. Please Help
I am having problem with configuring Hibernate sessionfactory. Please Help  Sir, I am having problem with configuring Hibernate sessionfactory.. I was using the old version of Hibernate before now I am using Hibernate 4
Tomcat installation problem - Hibernate Interview Questions
Tomcat installation problem   Hello
Hibernate with Annotation
Hibernate with Annotation           Hibernate needs a metadata to govern the transformation of data from POJO to database tables and vice versa. Most commonly XML file
Problem in Spring 3 MVC and Hibernate 3 Example tutorial source codes
Problem in Spring 3 MVC and Hibernate 3 Example tutorial source codes  I referred your tutorial "Spring 3 MVC and Hibernate 3 Example" and downloaded...]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException
Quick Hibernate Annotation Tutorial
the annotations for mapping all the hibernate POJO to the database tables...Hibernate Annotations      ... hands on experience before starting this tutorial. Introduction:- Hibernate
Introduction to POJO (Plain Old Java Object) Programming Model
Introduction to POJO (Plain Old Java Object) Programming Model... features of added by Sun Microsystems in EJB 3.0 is POJO (Plain Old Java.... Therefore, all normal Java objects are POJO?s only. The following classes
Hibernate getSession
In this section we will discuss about hibernate getSession() method
Hibernate : getCurrentSession()
This tutorial describes how getCurrentSession() method works in Hibernate
Hibernate get
In this section, you will learn about get method of Hibernate
Hibernate Training
Hibernate Training     Hibernate Training Get trained in Hibernate 3 with experts. Hibernate.... Hibernate training gives you skills need to use Hibernate to develop enterprise
Advertisements
 

 

 

DMCA.com