test
This commit is contained in:
parent
37776af5db
commit
ab03d5f10c
4045 changed files with 286212 additions and 3 deletions
30
.config/Code/User/History/-45886119/5ZOh.java
Normal file
30
.config/Code/User/History/-45886119/5ZOh.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package com.practice;
|
||||
|
||||
import org.hibernate.Transaction;
|
||||
|
||||
import org.hibernate.Session;
|
||||
|
||||
public class Main{
|
||||
public static void main(String[] args){
|
||||
|
||||
Session session = HibernateUtil.getSessionfactory().openSession();
|
||||
Transaction tx = null;
|
||||
try{
|
||||
tx = session.beginTransaction();
|
||||
Student arqam = session.get(Student.class, 232609);
|
||||
session.save(arqam);
|
||||
tx.commit();
|
||||
}
|
||||
catch(Exception e){
|
||||
if(tx != null){
|
||||
tx.rollback();
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally{
|
||||
session.close();
|
||||
}
|
||||
|
||||
HibernateUtil.shutdown();
|
||||
}
|
||||
}
|
1
.config/Code/User/History/-45886119/entries.json
Normal file
1
.config/Code/User/History/-45886119/entries.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":1,"resource":"file:///home/rafayahmad/Stuff/Hibernate/hibernate/src/main/java/com/practice/Main.java","entries":[{"id":"xmoH.java","timestamp":1711948795894},{"id":"5ZOh.java","timestamp":1711949736100}]}
|
30
.config/Code/User/History/-45886119/xmoH.java
Normal file
30
.config/Code/User/History/-45886119/xmoH.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package com.practice;
|
||||
|
||||
import org.hibernate.Transaction;
|
||||
|
||||
import org.hibernate.Session;
|
||||
|
||||
public class Main{
|
||||
public static void main(String[] args){
|
||||
|
||||
Session session = HibernateUtil.getSessionfactory().openSession();
|
||||
Transaction tx = null;
|
||||
try{
|
||||
tx = session.beginTransaction();
|
||||
Student arqam = session.get(Student.class, 232609);
|
||||
session.delete(arqam);
|
||||
tx.commit();
|
||||
}
|
||||
catch(Exception e){
|
||||
if(tx != null){
|
||||
tx.rollback();
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally{
|
||||
session.close();
|
||||
}
|
||||
|
||||
HibernateUtil.shutdown();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue