1 2 12 package com.versant.core.jdbc; 13 14 import com.versant.core.metadata.*; 15 import com.versant.core.jdbc.metadata.JdbcFetchGroup; 16 import com.versant.core.jdbc.metadata.JdbcField; 17 18 import java.util.ArrayList ; 19 20 23 public class JdbcFetchGroupBuilder extends FetchGroupBuilder { 24 25 public JdbcFetchGroupBuilder(ModelMetaData jmd) { 26 super(jmd, false, false); 27 } 28 29 protected StoreFetchGroup createStoreFetchGroup() { 30 return new JdbcFetchGroup(); 31 } 32 33 protected FetchGroupField createFetchGroupFieldWithPrefetch( 34 FieldMetaData fmd) { 35 FetchGroupField fgf = super.createFetchGroupFieldWithPrefetch(fmd); 36 if (fmd.category == MDStatics.CATEGORY_REF) { 37 fgf.jdbcUseJoin = JdbcField.USE_JOIN_OUTER; 38 } 39 return fgf; 40 } 41 42 protected FetchGroup createAllColumnsFetchGroup(ClassMetaData cmd) { 43 FetchGroup g = new FetchGroup(cmd, FetchGroup.ALL_COLS_NAME, createStoreFetchGroup()); 44 FieldMetaData[] fields = cmd.fields; 45 int n = fields.length; 46 ArrayList a = new ArrayList (n); 47 for (int i = 0; i < n; i++) { 48 FieldMetaData fmd = fields[i]; 49 if (fmd.persistenceModifier != MDStatics.PERSISTENCE_MODIFIER_PERSISTENT) { 50 continue; 51 } 52 if (fmd.isEmbeddedRef()) { 53 continue; 54 } 55 JdbcField jdbcField = (JdbcField)fmd.storeField; 56 if (jdbcField.mainTableCols == null || jdbcField.mainTableCols.length == 0) { 57 continue; 58 } 59 FetchGroupField fgf = new FetchGroupField(fmd); 60 if (fmd.category == MDStatics.CATEGORY_REF) { 61 fgf.jdbcUseJoin = JdbcField.USE_JOIN_NO; 62 } 63 a.add(fgf); 64 } 65 n = a.size(); 66 g.fields = new FetchGroupField[n]; 67 a.toArray(g.fields); 68 return g; 69 } 70 71 } 72 73 | Popular Tags |