Three level derived identity

test case and possible solution for https://hibernate.atlassian.net/browse/HHH-5764