Package org.xorm.datastore

Examples of org.xorm.datastore.DataFetchGroup


  fetchColumns = fetchGroup.getColumns();
  Column column;
  Iterator i = fetchGroup.getSubgroupColumns().iterator();
  while (i.hasNext()) {
      column = (Column) i.next();
      DataFetchGroup subgroup = fetchGroup.getSubgroup(column);
      // Find or create the Selector for the subgroup
      Selector selector = findSelector(condition, subgroup.getTable());
      if (selector == null) {
    selector = new Selector(subgroup.getTable(), null);
    selector.outerJoin = !column.isNonNull();
    Condition join = new SimpleCondition
        (column, Operator.EQUAL, selector);
    if (condition != null) {
        condition = new AndCondition(join, condition);
View Full Code Here


            Selector.Ordering[] ordering = new Selector.Ordering[1];
            ordering[0] = new Selector.Ordering(selector.getTable().getColumnByName(colName), orderingType);
            selector.setOrdering(ordering);
        }

        DataFetchGroup dfg = null;
        FetchGroupManager fgm = mgr.getInterfaceManagerFactory()
            .getFetchGroupManager();
        if (mapping.isMToN()) {
            // For many-to-many mappings, select all from the join table,
            // and then the default fetch group of the target table
            dfg = new DataFetchGroup(selector.getTable().getColumns());
            dfg.addSubgroup(mapping.getTarget().getColumn(),
                            fgm.getDataFetchGroup(classMapping));
        } else {
            dfg = fgm.getDataFetchGroup(classMapping);
        }
        selector.require(dfg);
View Full Code Here

    public Object invokeGet(String field, ClassMapping returnTypeMapping, Class returnType) {
        Column c = mapping.getColumn(field);
        if (c == null) throw new JDOUserException("No column for field " + field + " of class " + mapping.getMappedClass().getName());
        if (!getRow().containsValue(c)) {
            // Column fault: column was not in default fetch group
            DataFetchGroup dfg = new DataFetchGroup();
            dfg.addColumn(c);
            if (getRow().isCached()) {
                // We need to clone the row so we don't modify the cached Row
                Row theRow = (Row)getRow().clone();
                theRow.setCached(false);
                setRow(theRow);
View Full Code Here

        if (row == null) {

            // 2. Look in datastore

            // Get the DataFetchGroup to use.
            DataFetchGroup dfg = factory.getFetchGroupManager()
                .getDataFetchGroup(classMapping);
            Selector selector = new Selector
                (table,
                 new SimpleCondition(table.getPrimaryKey(),
                                     Operator.EQUAL,
View Full Code Here

        Table table = mapping.getTable();

        // Look in datastore
        Row row = null;

        DataFetchGroup dfg = new DataFetchGroup(table.getColumns());
        Selector selector = new Selector
            (table,
             new SimpleCondition(table.getPrimaryKey(),
                                 Operator.EQUAL,
                                 handler.getObjectId()));
View Full Code Here

    /**
     * Common code for both constructors.
     */
    private void init(){
        defaultFetchGroup = new DataFetchGroup();
        Iterator i = fields.iterator();
        while (i.hasNext()) {
            FieldDescriptor fd = (FieldDescriptor) i.next();
            // This is a kluge for now, maybe require explicit config on this?
            if (isUserType(fd.type)) {
View Full Code Here

public class TestFetchGroupManager extends FetchGroupManager {

    public DataFetchGroup getDataFetchGroup(ClassMapping mapping) {
  Table table = mapping.getTable();
  if ("employee".equals(table.getName())) {
      DataFetchGroup dfg = new DataFetchGroup(table.getColumns());
      mapping = XORM.getModelMapping(factory).getClassMapping(Address.class);
      DataFetchGroup dfg2 = new DataFetchGroup(mapping.getTable().getColumns());
      dfg.addSubgroup(table.getColumnByName("address_id"), dfg2);
      return dfg;
  } else {
      return super.getDataFetchGroup(mapping);
  }
View Full Code Here

TOP

Related Classes of org.xorm.datastore.DataFetchGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.