You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pc...@apache.org on 2008/04/22 20:42:47 UTC
svn commit: r650607 -
/openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EmbedFieldStrategy.java
Author: pcl
Date: Tue Apr 22 11:42:43 2008
New Revision: 650607
URL: http://svn.apache.org/viewvc?rev=650607&view=rev
Log:
OPENJPA-576. Committing on behalf of Sandeep Srivastava.
Modified:
openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EmbedFieldStrategy.java
Modified: openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EmbedFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EmbedFieldStrategy.java?rev=650607&r1=650606&r2=650607&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EmbedFieldStrategy.java (original)
+++ openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EmbedFieldStrategy.java Tue Apr 22 11:42:43 2008
@@ -405,6 +405,13 @@
return;
}
+ if (fetch.requiresFetch(field.getFieldMetaData())
+ != JDBCFetchConfiguration.FETCH_LOAD) {
+ return;
+ } else {
+ fetch = fetch.traverseJDBC(field.getFieldMetaData());
+ }
+
//### note: without a null indicator column, the above indicatesNull()
//### call will always return false, meaning we always have to assume
//### we selected the embedded object fields and load the object
@@ -417,7 +424,7 @@
FieldMapping[] fields = field.getEmbeddedMapping().getFieldMappings();
Object eres, processed;
- boolean loaded = false;
+ boolean loaded = true;
for (int i = 0; i < fields.length; i++) {
eres = res.getEager(fields[i]);
res.startDataRequest(fields[i]);
@@ -429,18 +436,24 @@
fields[i].loadEagerParallel(em, store, fetch, eres);
if (processed != eres)
res.putEager(fields[i], processed);
- } else
+ } else {
fields[i].load(em, store, fetch, res);
- loaded |= em.getLoaded().get(i);
+ }
+ FieldMetaData fm = fields[i].getFieldMetaData();
+ loaded &= em.getLoaded().get(i) ||
+ (fm != null && fetch.requiresFetch(fm)
+ != FetchConfiguration.FETCH_LOAD);
} finally {
res.endDataRequest();
}
}
- // after loading everything from result, load the rest of the
- // configured fields
- if (loaded)
- em.load(fetch);
+ // After loading everything from result, load the rest of the
+ // configured fields if anything is missing.
+ if (!loaded) {
+ em.load(fetch);
+ }
+
}
/**