HHH-9199

https://hibernate.atlassian.net/browse/HHH-9199

This pull request includes a unit test for the issue.