Note that this changes the `GridDialect` contract.

Taking projections into account, this `metadatas` parameter didn't seem right to me. Instead, this information can be obtained from `BackendCustomQuery`. I've added `getSingleEntityKeyMetadataOrNull()` there to facilitate the case of selecting a single entity type. We may add more powerful methods in the future should the need arise (e.g. when selecting relationships on Neo4j).