Created
November 10, 2019 16:47
-
-
Save Eragoo/989534715b2d1276c5fd3370545d5543 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import Entity.StudentsEntity; | |
import org.hibernate.Session; | |
public class App { | |
public static void main(String[] args) { | |
System.out.println("Hibernate tutorial"); | |
Session session = HibernateSessionFactory.getSessionFactory().openSession(); | |
session.beginTransaction(); | |
StudentsEntity studentsEntity = new StudentsEntity(); | |
short id = 10; | |
studentsEntity.setId(id); | |
studentsEntity.setSurname("Ku"); | |
studentsEntity.setName("Eugene"); | |
session.save(studentsEntity); | |
session.getTransaction().commit(); | |
session.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment