Add two methods to QueriesResource

These are:
  - QueryResult getQueryResultFromId(Long id)
  - QueryDefinition getQueryDefinitionForResult(QueryResult result)

See their Javadoc blocks for more information.
Annotate QueryDefinition with @EqualsAndHashCode