Cache MetaModel#getImplementors() results

Description

MetamodelImpl.getImplementors method is invoked whenever a criteria is executed with list() , getImplentors is iterating over all entity persisters available (>600 in my model) to resolve the implementors for a given class name, finally this causes a considerable overhead.

Given the implementors for a concrete class name would always be the same. It would be convenient to cache it.

Discussed in forums: https://forum.hibernate.org/viewtopic.php?f=1&t=1044025

Activity

Guillaume SmetJuly 3, 2018 at 5:04 PM

Fixed for the upcoming 5.3.2 thanks to an initial PR of Carlos Aristu!

Steve EbersoleNovember 10, 2017 at 2:06 AM

Its not true that this only affects Criteria. This is also used in interpreting HQL queries.

Former userNovember 9, 2017 at 7:37 PM

This only affects org.hibernate.Criteria, which is considered deprecated [1], so this will not be backported. You are better off migrating to JPA javax.persistence.criteria.CriteriaQuery.

[1] http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#appendix-legacy-criteria

Steve EbersoleOctober 19, 2017 at 10:49 AM

This is actually already done in the 6.0 work. I personally have no plans to backport that, but porting it should not be too difficult.

Asier LostaléOctober 19, 2017 at 10:24 AM

Finally, any plans to backport this to 5.x?

Fixed

Details

Assignee

Reporter

Components

Fix versions

Priority

Created February 16, 2017 at 1:46 PM
Updated July 5, 2018 at 12:17 PM
Resolved July 3, 2018 at 5:04 PM

Flag notifications