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();
}
}
}
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
Post a Comment