protected Union newUnion(final OpenJPAStateManager sm, final JDBCStore store,
final JDBCFetchConfiguration fetch, final ClassMapping[] elems,
final Joins[] resJoins) {
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);
}