User_A.java

package com.jtc.p1;


import org.hibernate.Session;
import org.hibernate.SessionFactory;


public class User_A {
    public static void main(String[] args) {
        org.hibernate.Transaction tx=null;
        try {
            System.out.println("hello");
            SessionFactory sf=Hibernate_Util.getSessionFatory();
            Session session=sf.openSession();
            tx=session.beginTransaction();
            Customer_PoJo cust=new Customer_PoJo("V", "a@gmail.com", "rok", 1234567893L, 12365L);
            session.save(cust);
            tx.commit();
            session.close();
            System.out.println("record inserted");
        }catch(Exception e) {
            e.printStackTrace();
            if(tx!=null)tx.rollback();
        }
       
   
    }
}

Comments

Popular posts from this blog

HTML& CSS USERNAME AND PASSWORD PAGE CODING

spring core exp

Swapping without using 3rd variable in c and c++ and any language use logic