@@ -0,0 +1,901 @@
+import org.hibernate.Transaction;%0D%0Aimport org.hibernate.Session;%0D%0Aimport org.hibernate.SessionFactory;%0D%0Aimport org.hibernate.cfg.Configuration;%0D%0A%0D%0Apublic class StoreData %7B%0D%0A%09%0D%0A%09public static void main(String%5B%5D args) %7B%0D%0A%09%09%0D%0A%09%09//creating configuration object%0D%0A%09%09Configuration cfg=new Configuration();%0D%0A%09%09cfg.configure(%22hibernate.cfg.xml%22); //populates the data of the configuration file%0D%0A%09%09%0D%0A%09%09//creating session factory object%0D%0A%09%09SessionFactory factory = cfg.buildSessionFactory();%0D%0A%09%09%0D%0A%09%09//creating session object%0D%0A%09%09Session session=factory.openSession();%0D%0A%09%09%0D%0A%09%09//creating transaction object%0D%0A%09%09Transaction t= session.beginTransaction();%0D%0A%09%09%0D%0A%09%09Employee e1=new Employee();%0D%0A%09%09e1.setId(115);%0D%0A%09%09e1.setFirstName(%22sonoo%22);%0D%0A%09%09e1.setLastName(%22Jaiswal%22);%0D%0A%09%09%0D%0A%09%09session.persist(e1); // persisting the object%0D%0A%09%09%0D%0A%09%09t.commit();%0D%0A%09%09session.close();%0D%0A%09%09%0D%0A%09%09System.out.println(%22sucessfully saved%22);%0D%0A%09%7D%0D%0A%0D%0A%7D%0D%0A

Add files via upload