}
// select data for this sm
final ClassMapping[] elems = getIndependentElementMappings(true);
final Joins[] resJoins = new Joins[Math.max(1, elems.length)];
Union union = store.getSQLFactory().newUnion
(Math.max(1, elems.length));
union.select(new Union.Selector() {
public void select(Select sel, int idx) {
ClassMapping elem = (elems.length == 0) ? null : elems[idx];
resJoins[idx] = selectAll(sel, elem, sm, store, fetch,
JDBCFetchConfiguration.EAGER_PARALLEL);
}
});
// create proxy
Object coll;
ChangeTracker ct = null;
if (field.getTypeCode() == JavaTypes.ARRAY)
coll = new ArrayList();
else {
coll = sm.newProxy(field.getIndex());
if (coll instanceof Proxy)
ct = ((Proxy) coll).getChangeTracker();
}
// load values
Result res = union.execute(store, fetch);
try {
int seq = -1;
while (res.next()) {
if (ct != null && field.getOrderColumn() != null)
seq = res.getInt(field.getOrderColumn());