/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package soidukid; import java.util.logging.Level; import java.util.logging.Logger; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import java.sql.Date; import java.util.GregorianCalendar; import java.util.Calendar; public class Proov1 { public static void main(String[] kapsas) { Logger log = Logger.getLogger("org.hibernate"); log.setLevel(Level.WARNING); Configuration c = new Configuration().configure(); SessionFactory sf = c.buildSessionFactory(); Session s = sf.openSession(); Transaction tx = s.beginTransaction(); try { /* Veesoiduk paat1=new Veesoiduk(); paat1.setMinsygavus(13.4); paat1.setOmanik("Mati"); paat1.setAasta(1988); s.save(paat1);*/ Soiduk jalgratas=new Soiduk(1959, "Jaagup"); //jalgratas.setOmanik("Jaagup"); //jalgratas.setAasta(1959); s.save(jalgratas); tx.commit(); } catch (Exception e) { System.out.println(e.getMessage().toString()); tx.rollback(); } s.close(); } }