Hibernate Persistence

This tutorial describes the concept of Hibernate persistence

Ads

Tutorials   
Hibernate 5 configuration dtd Hibernate 5 Hello World Getting started with Hibernate 5 Hibernate 5.2.10 jar Download Hibernate 5.2.10 Maven Dependency Hibernate 5 Maven Dependency Hibernate 5 native query example Hibernate 5 query deprecated When should you use Hibernate? What's new in Hibernate 5? How much time it takes to learn Hibernate? Hibernate envers custom revinfo table Hibernate 5 Envers Hibernate Envers get all revisions Hibernate Examples Hibernate 5 build SessionFactory Example Hibernate 5 SessionFactory Example Hibernate 5 Annotation Example How to download Hibernate 5.x? Hibernate 5 Features Hibernate 5 Tutorials Learning Hibernate ORM - Free Training/Tutorial videos of Hibernate ORM with Java How to write hello world example program in Hibernate? How to create one to one relationship in Hibernate 4 with Annotation? How to calculate minimum in Hibernate using the min() Function Hibernate ORM 4.2.21.Final Released - Create CURD application in latest Hibernate Hibernate ORM 4.2.21 Tutorial - Learn Hibernate ORM Framework Hibernate Error: Failed to create sessionFactory object.java.lang.NoClassDefFoundError How to create Hibernate Project in Eclipse? Examples of Hibernate Criteria Query Hibernate ORM 4.3.6.Final released Hibernate ORM 4.2.14.Final released Hibernate 4.3.4 Released: Hibernate 4.3.4.Final Maven dependency Hibernate association and join example Learn Hibernate programming with Examples Introduction to Hibernate Framework Hibernate Tutorial: Learn Hibernate with examples Hibernate 4.3 Hello World: Example Hibernate ORM 4.3.1.Final released How to create SessionFactory in Hibernate 4.3.1?

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.

Example:

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;

@Entity
@Table(name = "employee")
public class Employee {
@Id
@GeneratedValue
@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) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.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.

Advertisements

Ads
Share on Google+Share on Google+

Hibernate Persistence

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

Advertisements

 

Discuss: Hibernate Persistence  

Post your Comment


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

Ads

 

Ads