-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.java
63 lines (50 loc) · 1.67 KB
/
App.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package Hibernate_Practice.Prac;
import java.util.Date;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
/**
* Hello world!
*
*/
public class App
{
/**
* @param args
*/
public static void main( String[] args )
{
//
// XML based Hibernate Configuration
// Configuration cg = new Configuration();
// cg.configure();
// SessionFactory s = cg.buildSessionFactory();
// Session j = s.openSession();
// j.save(new Employee(1,"Anirudha","Gaikwad",04));
//
//
// Java Class based Hibernate Configuration
SessionFactory sessionFactory = Hibernate_Utils.getSeesionFactory();
Session session = sessionFactory.openSession();
System.out.println(sessionFactory);
System.out.println(session);
Transaction tx = session.beginTransaction();
//session.save(new Employee(1,"Anirudha","Gaikwad",04));
// Employee e2 = new Employee(2,"Sam","Gaikwad",05);
//Employee e3 = new Employee(3,"Abhineel","Dandge",8, new Date(2018,02,04));
//session.save(e2);
//e2.setFirst_name("Wasp");
//
//Order o1 = new Order("Fashion",new Date(2023,05,03), new Date(),"Amazon");
//Order o2 = new Order("Electronics",new Date(2023,02,01), new Date(2023,02,01),"Amazon");
//session.save(e3);
//ession.update(e2);
// session.save(o1);
// session.save(o2);
Order o3 = new Order("Home Appliances",new Date(2023,05,03), new Date(),"Amazon" );
session.save(o3);
tx.commit();
session.close();
}
}