HHH-9207

https://hibernate.atlassian.net/browse/HHH-9207

Added an unit test for the issue.