Statistics.getCollectionRoleNames() reports incorrect value
Description
Activity
Show:

Florian Beaufumé August 13, 2018 at 9:55 AM
For those who do not have the fix yet, here is a work around I use instead of "stats.getCollectionRoleNames()":
((MetamodelImplementor) sessionFactory.getMetamodel()).collectionPersisters().keySet()
Statistics:getCollectionRoleNames() returns an incorrect value because it uses MetamodelImpl:getAllCollectionRoles() that uses the "entityPersisterMap" attribute instead of "collectionPersisterMap".
The fix is quite simple: use the correct attribute in that getter.
I met this issue with Hibernate 5.2.12 and still saw it in the 5.2.17 and current (2018/08/13) master sources.
I will submit a PR for master. But it should be applied to other branches as well.
Note that this is my first Hibernate contribution, I'm not familiar with the process yet.