Bug 965833 - Potential bug in join/fetch/avoidance code
Potential bug in join/fetch/avoidance code
Status: ON_QA
Product: RHQ Project
Classification: Other
Component: Core Server (Show other bugs)
4.7
Unspecified Unspecified
unspecified Severity unspecified (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
Mike Foley
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-21 16:07 EDT by Heiko W. Rupp
Modified: 2018-01-30 12:57 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Heiko W. Rupp 2013-05-21 16:07:34 EDT
From server log:

21:39:47,740 WARN  [org.rhq.enterprise.server.util.CriteriaQueryGenerator] (http-/0.0.0.0:7080-87) Failed to add join fetch field on class [org.rhq.core.domain.configuration.ResourceConfigurationUpdate]: : java.lang.NoSuchFieldException: configuration


ResourceConfigurationUpdate has a 'configuration' in its super-super-class


More complete stacktrace:

21:39:42,900 WARN  [org.rhq.enterprise.server.util.CriteriaQueryGenerator] (http-/0.0.0.0:7080-87) Failed to add join fetch field on class [org.rhq.core.domain.configuration.ResourceConfigurationUpdate]: : java.lang.NoSuchFieldException: configuration
	at java.lang.Class.getDeclaredField(Class.java:1901) [rt.jar:1.7.0_21]
	at org.rhq.enterprise.server.util.CriteriaQueryGenerator.addJoinFetch(CriteriaQueryGenerator.java:703) [rhq-enterprise-server-ejb3.jar:4.8.0-SNAPSHOT]
	at org.rhq.enterprise.server.util.CriteriaQueryGenerator.getQueryString(CriteriaQueryGenerator.java:357) [rhq-enterprise-server-ejb3.jar:4.8.0-SNAPSHOT]
	at org.rhq.enterprise.server.util.CriteriaQueryGenerator.getQuery(CriteriaQueryGenerator.java:767) [rhq-enterprise-server-ejb3.jar:4.8.0-SNAPSHOT]
	at org.rhq.enterprise.server.util.CriteriaQueryRunner.getCollection(CriteriaQueryRunner.java:99) [rhq-enterprise-server-ejb3.jar:4.8.0-SNAPSHOT]
	at org.rhq.enterprise.server.util.CriteriaQueryRunner.execute(CriteriaQueryRunner.java:70) [rhq-enterprise-server-ejb3.jar:4.8.0-SNAPSHOT]
	at org.rhq.enterprise.server.configuration.ConfigurationManagerBean.findResourceConfigurationUpdatesByCriteria(ConfigurationManagerBean.java:2384)
Comment 1 Lukas Krejci 2013-05-24 13:19:49 EDT
commit https://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?id=078a2da4e488645284359940e3df7a61a0299109
Author: Lukas Krejci <lkrejci@redhat.com>
Date:   Fri May 24 16:43:50 2013 +0200

    [BZ 965833 - Potential bug in join/fetch/avoidance code]
    It is now possible to lazily fetch fields defined in super classes.
    
    The avoidance of the join-fetch with limits exposed a missing feature that
    was present in the code from the day one. It would be failing if the
    criteria query was used to fetch a custom object (i.e. not the primary
    persistent class of the criteria object) using an "altered projection" and
    a fetch would be set on a field defined in a super class of the persistent
    class of the criteria object. Only by chance this has never happened
    before, because we don't use the altered projections on the criteria
    queries that often.
    
    Now that we lazily fetch fields much more often (to avoid join fetch
    with limits) this is a problem even in cases without an altered projection.
    
    The fix is fortunately very simple - we need to also search the
    superclasses of the criteria's persistent class when looking for a field
    to lazily fetch.
    
    The possibility of fields being present in super-classes was taken into
    account on other places in the CriteriaQueryGenerator class, too.
    
    Documentation on the getJoinFetchFields() and alterProjection() was
    enhanced to hopefully better explain the conditions underwhich you can
    combine fetching and altered projection together.

Note You need to log in before you can comment on or make changes to this bug.