Hi to all ,
i am new to hibernate , i am tring to retrive data from database using hql , the code which i used is---
i am getting the records, but help me to ger a better one
Thanks for support.. Session s=null; try { SessionFactory sf=new Configuration().configure().buildSessionFactory(); s=sf.openSession(); String sql="from FacultyCourses"; Query q=s.createQuery(sql); for(Iterator it=q.iterate();it.hasNext();) { FacultyCourses obj=(FacultyCourses) it.next(); int a=obj.getNumberOfStudentEnrolled(); FacultyCoursesId aa= obj.getId(); String ap=aa.getFacultyId(); if(ap.equalsIgnoreCase("Fact519")) { System.out.println("fact:"+ obj.getDateCourseStarted()); break; } }
|