Hibernate pojo example



Share on Google+Share on Google+

Hibernate pojo example
2 Answer(s)      9 years ago
Posted in : Hibernate

I need a simple Hibernate Pojo example

View Answers

April 19, 2008 at 8:26 PM



package roseindia;

import org.hibernate.*;
import org.hibernate.criterion.*;
import org.hibernate.cfg.*;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import java.util.*;

public class pojoexample {
public static void main(String arg[]){
Session session = null;
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();
org.hibernate.Transaction tx = session.beginTransaction();
System.out.println("Insert data into database");
HibernatePojoExample pojo = new HibernatePojoExample();

}catch(Exception e){

hibernate mapping

<class name="roseindia.HibernatePojoExample" table="pojoinformation">
<id name="id" type="int" column="id" >
<generator class="assigned"/>

<property name="username">
<column name="username" />
<property name="lastname">
<column name="lastname"/>
<property name="address">
<column name="address"/>
<property name="qualification">
<column name="qualification"/>

<property name="state">
<column name="state"/>


April 19, 2008 at 8:28 PM


package roseindia;

public class HibernatePojoExample {

private String username;
private String lastname;
private String address;
private String qualification;
private String state;
private int id;

public String getUsername(){
return username;
public void setUsername(String username) {
this.username = username;
public String getLastname() {
return lastname;
public void setLastname(String lastname) {
this.lastname = lastname;
public String getAddress() {
return address;
public void setAddress(String address) {
this.address = address;

public String getQualification(){
return qualification;
public void setQualification(String qualification){
this.qualification = qualification;
public String getState(){
return state;
public void setState(String state){
this.state = state;
public int getId() {
return id;
public void setId(int id) {
this.id = id;


read for more information,


hope it will help u


Related Tutorials/Questions & Answers:
pojo generation - Hibernate
pojo generation  Can we create a pojo from a data of two different tables
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
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 java.util.*; public class Employee { private String empname; private int
Hibernate Example
This tutorial illustrate an example of hibernate
Dirty Checking In Hibernate Example
Dirty Checking In Hibernate Example  What is the example of Dirty Checking in Hibernate? Give me some of the example code? Thanks
Hibernate Criteria And Or Example
Hibernate Criteria And Or Example  Hibernate Criteria And Or Example I want example of Hibernate Criteria And Or in Java Thanks   Example of Hibernate Criteria And Or Criteria Check the tutorial Hibernate Criteria
hibernate annotations example for mappings
hibernate annotations example for mappings  Please send me example of hibernate annotations for mappings.Please send the example   Please go through the following link: Hibernate Annotations
Hibernate Criteria Count Example
Hibernate Criteria Count Example  Example of Hibernate Criteria Count. Check the tutorial Hibernate Criteria Count. Check the Latest tutorials, articles and examples of Hibernate Framework. Thanks
Hibernate criteria date Example
Hibernate criteria date Example  Example of Hibernate criteria date. Check the tutorial hibernate criteria date. Check the Latest tutorials, articles and examples of Hibernate Framework. Thanks
Hibernate Spring Example
In this section, you will learn how to Integration Hibernate with Spring with an example
Simple Example of Hibernate 4
Simple Example of Hibernate 4  Hi, As a new comer in the Hibernate.... Share me the best example. Thanks   Hi, Check tutorial: Hibernate 4 Simple Example More Tutorials for a beginner: Hibernate Tutorials Home page
Dialect in Hibernate Example
Dialect in Hibernate Example   I want example of Dialect in Hibernate...   List of Dialect in Hibernate ORM framework. Check the tutorial Dialect in Hibernate. Check the Latest tutorials, articles and examples of Hibernate
Hibernate criteria average Example
Hibernate criteria average Example   How to find the average in Hibernate? Thanks   Example of finding average on a filed in Hibernate... the tutorial Hibernate criteria avg.. Check the Latest tutorials, articles
Hibernate Criteria With Collections Example
Hibernate Criteria With Collections Example  Good code of Hibernate Criteria With Collections Example. Thanks   Example program of using Hibernate Criteria With Collections in your Java project. Check the tutorial
Hibernate Criteria Between Example
Hibernate Criteria Between Example  How to use the Between in the Hibernate Query? Share me good example code. Thanks   Example of Hibernate Criteria Between. Check the tutorial Hibernate Criteria Between. Check
Hibernate Criteria And Restrictions Example
Hibernate Criteria And Restrictions Example  How to use Criteria And Restrictions in Hibernate? Thanks   I will provide you the example code of Hibernate Criteria And Restrictions. Check the tutorial Hibernate
Hibernate criteria for date. Example
Hibernate criteria for date. Example  What to use the Hibernate criteria for date in Hibernate based application? I want example of Hibernate criteria for date in Hibernate orm. Thanks   Example of Hibernate criteria
Dirty Checking In Hibernate Example
Dirty Checking In Hibernate Example  Hi, What is Dirty Checking In Hibernate? Explain me with the help of Example. Thanks   The Dirty Checking In Hibernate is an mechanism for automatically detects the changes
Hibernate envers example
at roseindia.net: Example of Hibernate 5 Envers How to get all revisions in Hibernate Envers? Hibernate envers custom revinfo table example Thanks...Hibernate envers example  Hi, I am looking for the running examples
Explain Hibernate Relationships with example.
Explain Hibernate Relationships with example.  Hello, Please explain various hibernate relationships. And if you can provide some examples that would be a great help.. Thank you....   Hi, Hibernate relational
Hibernate Detached Criteria Example
is useful when Hibernate session is not available. Check the example of Hibernate...Hibernate Detached Criteria Example  How to use Hibernate Detached Criteria in Java program? What is the use of Hibernate Detached Criteria? Explain
Hibernate Criteria Wildcard Example
want example of Hibernate Criteria Wildcard which is easy to understand. Thanks   Example tutorial in Hibernate for getting the data through...Hibernate Criteria Wildcard Example  Hi, How to write Java program
hibernate criteria disjunction Example
hibernate criteria disjunction Example  I want example of hibernate criteria disjunction. Thanks   Example of hibernate criteria disjunction. Please check the tutorial hibernate criteria disjunction. This tutorial
Hibernate Detached Criteria Example
Hibernate Detached Criteria Example  can anyone share me the source code of using detached Criteria in Hibernate? Thanks   Hi, If you are looking for the Example program of using Hibernate Detached Criteria
Hibernate Criteria Transformer Example
Hibernate Criteria Transformer Example  I want example of Hibernate...   Here I am giving you the link of Hibernate Criteria Transforme example program. Check the tutorial Hibernate Criteria Transformer . Check the Latest
Dirty Checking In Hibernate Example
Dirty Checking In Hibernate Example  What is the example of Dirty Checking in Hibernate? Give me some of the example code? Thanks   The Dirty Checking In Hibernate is used to track the status of the entity and detect
Hibernate delete example program
Hibernate delete example program  How to delete an object in Hibernate? In my program I have to write program to delete the data using Hibernate... session.delete(emp); Check the tutorial Hibernate Session.delete() Example
Hibernate 4 Example with Eclipse
Hibernate 4 Example with Eclipse   I am a beginner and want to know about the Hibernate 4 Example with Eclipse and how to install it. Can someone... can do first Example of Hibernate with Eclipse and below link can help you
hibernate by example
In this tutorial you will learn hibernate by example with ready made downloadable source code
Hibernate envers audit example
Hibernate envers audit example  Hi, Hibernate envers is popular for versioning the entity. I am searching for Hibernate envers audit example. Give me the code or examples of Hibernate audit, which gets and prints the audited
Hibernate Criteria Query Example
Hibernate Criteria Query Example  Hi, How to create Hibernate Criteria Query Examples in Java program? Share me the easy to learn example code. Thanks   Hi, Hibernate Criteria Query is used to selectively find


Advertisement null