HHH-7821 - Clear the batch fetch queue on flush

Hi,

Here is the pull request for HHH-7821.

The first commit is the test case. The second one is the proposed fix.

I think it's better to clear the entire BatchFetchQueue on flush, even if only clearing the collection batch fetching queue is enough to fix the issue. That's why I fixed it this way (I can do it the other way if preferred).

I also added a safe guard against NPE on CollectionEntry.getLoadedKey() in BatchFetchQueue.getCollectionBatch() itself. It seems to me testing it is cheap and protects us against future changes in this area.