We're updating the issue view to help you get more done. 

QueryTranslatorImpl makes invalid class resolutions

Description

When performing JPA Criteria queries, there are many calls to ReflectHelper.getConstantValue with values like "generatedAlias0", which in turn attempts to load the class "generatedAlias0". This naturally fails, but resolving the class and throwing/cachting the exception is quite expensive in terms of cpu performance. No such calls should be made.

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

Environment

None

Status

Assignee

Unassigned

Reporter

Remo Meier

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major