Code example for Session

Methods: closesavebeginTransactiongetTransaction

0
	} 
 
	@Test
	public void testFindBySQLSimpleByDiffSessions() throws Exception {
		Session session = openSession();
		session.beginTransaction();
		Category s = new Category(); 
		s.setName(String.valueOf(nextLong++));
		session.save(s);
		session.getTransaction().commit();
		session.close();
 
		if ( getDialect() instanceof MySQLDialect ) {
			return; 
		} 
 
		session = openSession();
		session.beginTransaction();
 
		Query query = session.createSQLQuery( "select s.category_key_col as {category.id}, s.name as {category.name}, s.\"assign-able-id\" as {category.assignable} from {category} s" )