
Explain the persistence class in hibernate?

Hi Samar,
Persistence class is a class in our web application. It holds the entities of the business application (Example- Employee id and name etc.). Hibernate works better if these classes follow some rules. It is also known as the Plain Old Java Object (POJO) programming model.
Thanks...

Hi Samar,
Persistence class is a class in our web application. It holds the entities of the business application (Example- Employee id and name etc.). Hibernate works better if these classes follow some rules. It is also known as the Plain Old Java Object (POJO) programming model.
Example of POJO
package net.roseindia.Model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "userinfo")
public class AddInformation implements Serializable {
private int id;
private String firstname;
@Id
@GeneratedValue
@Column(name = "id")
public int getId() {
return id;
}
@Column(name = "firstname")
public String getFirstname() {
return firstname;
}
public void setId(int id) {
this.id = id;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
}
Thanks....
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.