I have done all configuration fro hibernate ,
My this code executed ----and display all fields


import java.util.ArrayList;

import org.hibernate.Session;
import org.hibernate.Query;

public class First {
public static void main(String args[])
{
First F =new First();
Person P =new Person();
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
String query = "select p from Person p ";
Query q= session.createQuery(query);
ArrayList al=(ArrayList)q.list();
Person p1=(Person)al.get(0);

int x=p1.getId();
int y=p1.getAge();
String z=p1.getFirstname();
String k=p1.getLastname();
System.out.println("Person-Id---"+ x);
System.out.println("Age---"+y);
System.out.println("FirstName---"+z);
System.out.println("LastName---"+k);


//session.save(P);

session.getTransaction().commit();
}

}


My this code did not execute ----i am doing from this code insert value in database


import java.util.ArrayList;

import org.hibernate.Session;
import org.hibernate.Query;

public class First {
public static void main(String args[])
{
First F =new First();
Person P =new Person();
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
P.setAge(111);
P.setFirstname("aaaaaaa");
P.setLastname("dsssss");
P.setId(12);
session.save(P);


session.beginTransaction().commit();
}

}

Plz Help Me
I hope to all of
Edit/Delete Message