01: package org.xorm.tests;
02:
03: import org.xorm.ClassMapping;
04: import org.xorm.FetchGroupManager;
05: import org.xorm.XORM;
06: import org.xorm.datastore.DataFetchGroup;
07: import org.xorm.datastore.Table;
08: import org.xorm.tests.model.*;
09:
10: public class TestFetchGroupManager extends FetchGroupManager {
11:
12: public DataFetchGroup getDataFetchGroup(ClassMapping mapping) {
13: Table table = mapping.getTable();
14: if ("employee".equals(table.getName())) {
15: DataFetchGroup dfg = new DataFetchGroup(table.getColumns());
16: mapping = XORM.getModelMapping(factory).getClassMapping(
17: Address.class);
18: DataFetchGroup dfg2 = new DataFetchGroup(mapping.getTable()
19: .getColumns());
20: dfg.addSubgroup(table.getColumnByName("address_id"), dfg2);
21: return dfg;
22: } else {
23: return super.getDataFetchGroup(mapping);
24: }
25: }
26: }
|