/**
 * 
 */
package roseindia;

import java.util.Iterator;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

/**
 * @author Administrator
 *
 */
public class ReadData {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		SessionFactory sessFact = HibernateUtil.getSessionFactory();
		Session sess = sessFact.getCurrentSession();
		Transaction tr = sess.beginTransaction();
		Query query = sess.createQuery("from Student");
		List result = query.list(); 
		Iterator it = result.iterator();
		System.out.println("id  sname  sroll  scourse where id > 10");
		while(it.hasNext()){
			Student st = (Student)it.next();
			System.out.print(st.getId());
			System.out.print("   "+st.getSname());
			System.out.print("   "+st.getSroll());
			System.out.print("   "+st.getScourse());
			System.out.println();
		}
		sessFact.close();

	}

}
