In this tutorial you will learn how to create a POJO class in Hibernate.
POJO (Plain Old Java Object) is a programming model that follow some simple rules (not required to follow these rules hardly) to create a classes that implements the entities of the business problem. These can be as follows :
Example :
Here I am giving an example of POJO class. This class contains some fields using which I have created setter and getter methods. I have also created a default constructor. A simple dummy POJO class example is as follows :
package roseindia;
public class Employee
{
private long empId;
private String empName;
public Employee() {
}
public Employee(String empName) {
this.empName = empName;
}
public long getEmpId() {
return this.empId;
}
public void setEmpId(long empId) {
this.empId = empId;
}
public String getEmpName() {
return this.empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}
}
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.
Ask Questions? Discuss: Hibernate create POJO classes
Post your Comment