From bc9d60fe3bda89a1b300b68328ac7bb6067ff491 Mon Sep 17 00:00:00 2001 From: Patrick Linskey Date: Wed, 31 Oct 2007 00:29:38 +0000 Subject: [PATCH] OPENJPA-407. Backing out attempted optimization due to regressions in test suite. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@590520 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/kernel/FetchConfiguration.java | 7 +++---- .../openjpa/kernel/FetchConfigurationImpl.java | 16 ++++------------ 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfiguration.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfiguration.java index 9fc3e0262..40c00ca4f 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfiguration.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfiguration.java @@ -349,15 +349,14 @@ public interface FetchConfiguration /** * Affirms if the given fields require to be fetched in the context of * the given fetch group set. Returns a BitSet that contains one of - * {@link #FETCH_NONE}, {@link #FETCH_LOAD}, {@link #FETCH_REF} for each + * {@link #FETCH_NONE}, {@link #FETCH_LOAD}, {@link FETCH_REF} for each * field. * * @param fgs fetch group set * @param fmds array of fields to be examined - * @return BitSet that indicates whether fetches are required or not, or - * null if no fields require a fetch. + * @return BitSet that indicates whether fetches are required or not */ - public BitSet requiresFetch(Set fgs, FieldMetaData[] fmds); + public BitSet requiresFetch(Set fgs, FieldMetaData[] fmds ); /** * Return false if we know that the object being fetched with this 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 fe2cfd8f2..17e0cc5d2 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 @@ -537,7 +537,7 @@ public class FetchConfigurationImpl } public BitSet requiresFetch(Set fgs, FieldMetaData[] fmds) { - BitSet fields = null; + BitSet fields = new BitSet(fgs.size()); Iterator itr = fgs.iterator(); while (itr.hasNext()) { fields = includes((FieldMetaData) itr.next(), fmds, fields); @@ -594,10 +594,8 @@ public class FetchConfigurationImpl if ((fmd.isInDefaultFetchGroup() && hasFetchGroup(FetchGroup.NAME_DEFAULT)) || hasFetchGroup(FetchGroup.NAME_ALL) || hasField(fmd.getFullName(false))) { - if (indirectFetch(fmd) != FETCH_NONE) { - fields = new BitSet(fmds.length); + if (indirectFetch(fmd) != FETCH_NONE) fields.set(fmd.getIndex()); - } return fields; } // now we need to see if this field associates with @@ -605,11 +603,8 @@ public class FetchConfigurationImpl String[] fgs = fmd.getCustomFetchGroups(); for (int i = 0; i < fgs.length; i++) { if (hasFetchGroup(fgs[i])) { - if (indirectFetch(fmd) != FETCH_NONE) { - if (fields == null) - fields = new BitSet(fmds.length); + if (indirectFetch(fmd) != FETCH_NONE) fields.set(fmd.getIndex()); - } // check whether this field has a loadFetchGroup // if it has a LoadFetchGroup, then we need to get // all the fields that associate with this LoadFetchGroup @@ -619,11 +614,8 @@ public class FetchConfigurationImpl // merge the loadFetchGroup fields to the retuned fields. if (fldIndex != null && !fldIndex.isEmpty()) { for (int j = 0; j < fldIndex.length(); j++) - if (fldIndex.get(j)) { - if (fields == null) - fields = new BitSet(fmds.length); + if (fldIndex.get(j)) fields.set(j); - } } } }