Code example for Session

Methods: closedeletegetbeginTransactiongetTransaction

0
		s.persist( emp );
		s.getTransaction().commit();
		s.close();
 
		s = openSession();
		s.beginTransaction();
		s.delete( emp );
		emp = ( Employer ) s.get( Employee.class, emp.getId() );
		s.getTransaction().commit();
		s.close();
 
		assertNull( "get did not return null after delete", emp );
	} 
 
	private void clearCounts() { 
		sessionFactory().getStatistics().clear(); 
	} 
	 
	private void assertFetchCount(int count) {
		int fetches = (int) sessionFactory().getStatistics().getEntityFetchCount();