From 00c27c654af529e1c71d5c696f4f66edf1e17305 Mon Sep 17 00:00:00 2001 From: Pinaki Poddar Date: Mon, 25 Aug 2008 16:57:06 +0000 Subject: [PATCH] Check for field inclusion in fetch group based on names of both decalring and defining class as owner. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@688777 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/openjpa/kernel/FetchConfigurationImpl.java | 7 ++++--- .../main/java/org/apache/openjpa/meta/FieldMetaData.java | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java index 9363edb9d..40b44d1da 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java @@ -574,14 +574,14 @@ public class FetchConfigurationImpl clone._fromField = fm.getFullName(false); clone._fromType = type; clone._availableRecursion = getAvailableRecursionDepth(fm, type, true); - if (StringUtils.equals(_directRelationOwner, fm.getFullName())) + if (StringUtils.equals(_directRelationOwner, fm.getFullName(false))) clone._load = false; else clone._load = _load; FieldMetaData owner = fm.getMappedByMetaData(); if (owner != null && owner.getTypeCode() == JavaTypes.PC) - clone._directRelationOwner = owner.getFullName(); + clone._directRelationOwner = owner.getFullName(false); return clone; } @@ -593,7 +593,8 @@ public class FetchConfigurationImpl if (hasFetchGroupAll() || (fmd.isInDefaultFetchGroup() && hasFetchGroupDefault()) - || hasField(fmd.getFullName(false))) + || hasField(fmd.getFullName(false)) + || hasField(fmd.getRealName())) return true; String[] fgs = fmd.getCustomFetchGroups(); for (int i = 0; i < fgs.length; i++) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java index 467efdbfd..6a8c91b90 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java @@ -349,6 +349,13 @@ public class FieldMetaData return (embedOwner) ? _embedFullName : _fullName; } + /** + * The field name, qualified by the defining class. + */ + public String getRealName() { + return getDefiningMetaData().getDescribedType().getName() + "." + _name; + } + /** * MetaData about the field value. */