Restrictions.isEmpty() / isNotEmpty() fail when collection is mapped to superclass.
Description
When attempting to use the Restrictions.isNotEmpty() method for a collection that is mapped to the superclass, a MappingException is thrown when looking up the CollectionPersister.
Looking at the code, the CollectionPersister is stored using the superclass name, in my case "test.subclass.collections.Person.races"
But when the SQL is being generated for the criterion, the role passed into the SessionFactoryImpl.getCollectionPersister(String role) method is "test.subclass.collections.Client.races" presumeably since the Criteria was created for the Client.class.
When attempting to use the Restrictions.isNotEmpty() method for a collection that is mapped to the superclass, a MappingException is thrown when looking up the CollectionPersister.
Looking at the code, the CollectionPersister is stored using the superclass name, in my case "test.subclass.collections.Person.races"
But when the SQL is being generated for the criterion, the role passed into the SessionFactoryImpl.getCollectionPersister(String role) method is "test.subclass.collections.Client.races" presumeably since the Criteria was created for the Client.class.
See attached TestCase.