Last active
September 23, 2018 12:12
-
-
Save bayraktugrul/fd32442a78b6944c451544548e58b966 to your computer and use it in GitHub Desktop.
Revisions
-
bayraktugrul revised this gist
Sep 23, 2018 . 1 changed file with 0 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,4 @@ package com.hibernateyazilari.hibernate_2; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; -
bayraktugrul revised this gist
Sep 20, 2018 . 1 changed file with 4 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,15 +9,12 @@ public class App { public static void main( String[] args ) { SessionFactory factory = new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(Student.class) .buildSessionFactory(); Session session = factory.getCurrentSession(); try { Student student = new Student("Tuğrul","Bayrak", "[email protected]"); session.beginTransaction(); @@ -26,7 +23,6 @@ public static void main( String[] args ) { } finally { factory.close(); } } } -
bayraktugrul created this gist
Sep 20, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ package com.hibernateyazilari.hibernate_2; import javax.imageio.spi.ServiceRegistry; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.service.internal.SessionFactoryServiceRegistryBuilderImpl; public class App { public static void main( String[] args ) { SessionFactory factory = new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(Student.class) .buildSessionFactory(); Session session = factory.getCurrentSession(); try { Student student = new Student("Tuğrul","Bayrak", "[email protected]"); session.beginTransaction(); session.save(student); session.getTransaction().commit(); } finally { factory.close(); } } }