Hi friends
i came out of last posted query
i can able run the program but in database no records found
this is my
java file
------------------------------
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import java.io.*;
public class FirstExample {
public static void main(
String[] args) {
Session session = null;
try{
SessionFactory sessionFactory =new Configuration().configure(new File("hibernate.cfg.xml")).buildSessionFactory();
System.out.println("Inserting Record");
session =sessionFactory.openSession();
//Create new instance of Contact and set values in it by reading them from form object
System.out.println("Inserting Record");
Contact contact = new Contact();
contact.setId(3);
contact.setFirstName("Deepak");
contact.setLastName("Kumar");
contact.setEmail("
[email protected]");
session.save(contact);
System.out.println("Done");
}catch(Exception e){
System.out.println(e.getMessage());
}finally{
session.flush();
session.close();
}
}
}
-----------------------------------
why this is happening, let me know how to solve
any help greatly cherished
Mallik