package esimene; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; public class Test1 { public static void main(String[] kapsas) { Configuration c = new Configuration().configure(); SessionFactory sf = c.buildSessionFactory(); Session s = sf.openSession(); Transaction tx = s.beginTransaction(); try { Isik isik = new Isik(); isik.setEesnimi("Malle"); isik.setPerekonnanimi("Tamm"); s.save(isik); tx.commit(); } catch (Exception e) { System.out.println(e.getMessage().toString()); tx.rollback(); } s.close(); } }