Share on Google+Share on Google+

Hibernate Persistence

This tutorial describes the concept of Hibernate persistence

Hibernate Persistence

This tutorial describes the concept of Hibernate persistence.

Hibernate persistence:

Hibernate persistence manages your database and the mapping between the database and the object.
Many tools facilitating the concept of persisting java objects to a relational database.
Hibernate is one of them. It permits developer to persistence engines in converting database column to java object and back.

Persistence class are simple POJO classes in an application. It works as implementation of the business application
for example Employee , department etc. It is not necessary that all instances of persistence class are defined persistence.


package net.roseindia.table;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

@Table(name = "employee")
public class Employee {
@Column(name = "emp_id")
private int id;

@Column(name = "name")
private String name;

@Column(name = "salary")
private int salary;

@Column(name = "date_of_join")
private Date dateOfJoin;

public int getId() {
return id;

public void setId(int id) { = id;

public String getName() {
return name;

public void setName(String name) { = name;

public int getSalary() {
return salary;

public void setSalary(int salary) {
this.salary = salary;

public Date getDateOfJoin() {
return dateOfJoin;

public void setDateOfJoin(Date dateOfJoin) {
this.dateOfJoin = dateOfJoin;


Description: The javax.persistence package contains the classes and interfaces that is used to define the relationship between persistence provider and the managed classes the client of java persistence API.


Posted on: June 26, 2012 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Hibernate Persistence  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image