/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package soidukid; import org.hibernate.Session; import org.hibernate.SessionFactory; //import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; /** * * @author opetaja */ public class Proov2 { public static void main(String[] kapsas) { Configuration c = new Configuration().configure(); SessionFactory sf = c.buildSessionFactory(); Session s = sf.openSession(); // Transaction tx = s.beginTransaction(); try { Soiduk sd = (Soiduk)s.get(Soiduk.class, 1); System.out.println(sd.getOmanik()); // tx.commit(); } catch (Exception e) { System.out.println(e.getMessage().toString()); // tx.rollback(); } s.close(); } }