Uploaded image for project: 'Hibernate ORM'
  1. Hibernate ORM
  2. HHH-10746

Criteria API drastically degrades performance

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 5.1.0
    • Fix Version/s: None
    • Component/s: hibernate-core
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      Especially in multi-threaded in environments, the classloader is accessed way to often to convert the Criteria Query into SQL. In some containers like Tomcat we observed that the classloader is synchronized. This combination drastically degrades performance of our application servers.

      see

      http://dimovelev.blogspot.ch/2015/02/performance-pitfalls-hibernate-criteria.html

      or

      http://stackoverflow.com/questions/26608973/synchronized-classloader-calls-from-hibernate/37279205#37279205

      or

      https://hibernate.atlassian.net/browse/HHH-9895

      which was closed without further information. The code in question:

      Thread [main] (Suspended (breakpoint at line 191 in ReflectHelper))	
      owns: QueryTranslatorImpl (id=8378)	
      ReflectHelper.classForName(String) line: 191	
      ReflectHelper.getConstantValue(String) line: 279	
      QueryTranslatorImpl$JavaConstantConverter.handleDotStructure(AST) line: 624	
      QueryTranslatorImpl$JavaConstantConverter.visit(AST) line: 619	
      NodeTraverser.visitDepthFirst(AST) line: 78	
      NodeTraverser.traverseDepthFirst(AST) line: 67	
      QueryTranslatorImpl.parse(boolean) line: 300	
      QueryTranslatorImpl.doCompile(Map, boolean, String) line: 203	
      QueryTranslatorImpl.compile(Map, boolean) line: 158	
      HQLQueryPlan.<init>(String, String, boolean, Map<String,Filter>, SessionFactoryImplementor, EntityGraphQueryHint) line: 131	
      HQLQueryPlan.<init>(String, boolean, Map<String,Filter>, SessionFactoryImplementor) line: 93	
      QueryPlanCache.getHQLQueryPlan(String, boolean, Map<String,Filter>) line: 167	
      SessionImpl(AbstractSessionImpl).getHQLQueryPlan(String, boolean) line: 301	
      SessionImpl(AbstractSessionImpl).createQuery(String) line: 236	
      SessionImpl.createQuery(String) line: 1800	
      EntityManagerImpl(AbstractEntityManagerImpl).createQuery(String, Class<T>, Selection, QueryOptions) line: 568	
      CriteriaQueryImpl$1.buildCompiledQuery(HibernateEntityManagerImplementor, InterpretedParameterMetadata) line: 336	
      CriteriaCompiler.compile(CompilableCriteria) line: 147	
      EntityManagerImpl(AbstractEntityManagerImpl).createQuery(CriteriaQuery<T>) line: 736
      Activity
      

      A solution/workaround for this problem is necssary.

        Attachments

          Activity

            People

            • Votes:
              9 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: