package ee.bcs.andmed.jaagup; import org.hibernate.*; import org.hibernate.cfg.AnnotationConfiguration; public class AndmeProov4 { public static void main(String[] args) { SessionFactory sf=new AnnotationConfiguration().configure().buildSessionFactory(); Session s=sf.openSession(); Criteria cr=s.createCriteria(Kodanik.class); java.util.List kodanikud=cr.list(); for(Object obj: kodanikud){ Kodanik k=(Kodanik)obj; System.out.println(k.eesnimi+" "+k.numbrid); } s.close(); } }