@Test public void getStudents { Students student= null; Session session = null; Transaction tx = null; try{ session = HibernateUtil.getSession(); tx = session.beginTransaction(); student= (Students)session.load(Students.class, 67833); tx.commit(); }catch(Exception e){ e.printStackTrace(); }finally{ session.close(); } }