@Override
	public SQLResult executeSqlQuery(String query) throws Exception {
		Session session = null;
		Transaction trx = null;
		SQLResult result = new SQLResult();
		
		try {
			session = sessionFactory.openSession();
			trx = session.beginTransaction();
			
			PreparedStatement statement = session.connection().prepareStatement(query);
			ResultSet rs = statement.executeQuery();
			ResultSetMetaData rsmd = rs.getMetaData();
			
			//create header
			String[] header = new String[rsmd.getColumnCount()];
			for(int i=1; i<=rsmd.getColumnCount(); i++) {
				header[i-1] = (rsmd.getColumnName(i));
			}
			result.setHeader(header);
			
			//create body
			List<String[]> body = new ArrayList<String[]>();
			while(rs.next()) {
				String[] values = new String[rsmd.getColumnCount()];
				for(int i=1; i<=rsmd.getColumnCount(); i++) {
					values[i-1] = rs.getString(i);
				}
				body.add(values);
			}
			result.setBody(body);
		} catch(HibernateException e) {
			if(trx != null) {
				try {trx.rollback(); } catch(HibernateException he) {}
			}
		} finally {
			try { if( session != null ) session.close(); } catch( Exception exC1 ) {}
		}
		return result;
	}