Package org.apache.cayenne.access

Examples of org.apache.cayenne.access.DataContext.performQuery()


            } else if (getNamedQuery() != null) {
                list = dataContext.performQuery(getNamedQuery());

            } else if (getQueryName() != null) {
                 list = dataContext.performQuery(getQueryName(), false);

            } else {
                Class doClass = cayenneForm.getDataObjectClass();
                String getterName = ClickUtils.toGetterName(getName());
                Method method = doClass.getMethod(getterName);
View Full Code Here


                } else if (getOptionLabel() != null && !orderingApplied) {
                    query.addOrdering(getOptionLabel(), true);
                    orderingApplied = true;
                }

                list = dataContext.performQuery(query);
            }

            if (isRequired() && optionList.isEmpty() || isOptional()) {
                optionList.add(Option.EMPTY_OPTION);
            }
View Full Code Here

        Expression qualifier = Expression.fromString("db:" + pk.getName() + " in $ids");
        Map params = Collections.singletonMap("ids", ids);
        SelectQuery query = new SelectQuery(javaClass, qualifier
                .expWithParameters(params));
        return context.performQuery(query);
    }

    /**
     * Returns preference details keyed using their master key.
     */
 
View Full Code Here

        // need to make sure source relationship is resolved as a result of some Ashwood
        // strangeness...
        d1.getEmployees().size();

        // resolve Employees
        context1.performQuery(new SelectQuery(Employee.class));

        DeepMergeOperation op = new DeepMergeOperation(context1);

        blockQueries();
        try {
View Full Code Here

        o2.setToParent(o1);

        context.commitChanges();

        Expression qualifier = ExpressionFactory.matchExp("children", o2);
        List parents = context.performQuery(new SelectQuery(
                ReflexiveAndToOne.class,
                qualifier));
        assertEquals(1, parents.size());
        assertSame(o1, parents.get(0));
View Full Code Here

                qualifier));
        assertEquals(1, parents.size());
        assertSame(o1, parents.get(0));

        qualifier = ExpressionFactory.matchExp("children", o1);
        parents = context
                .performQuery(new SelectQuery(ReflexiveAndToOne.class, qualifier));
        assertEquals(0, parents.size());
    }

    public void testQualifyOnToOne() {
View Full Code Here

        o2.setToParent(o1);

        context.commitChanges();

        Expression qualifier = ExpressionFactory.matchExp("toParent", o1);
        List children = context.performQuery(new SelectQuery(
                ReflexiveAndToOne.class,
                qualifier));
        assertEquals(1, children.size());
        assertSame(o2, children.get(0));
    }
View Full Code Here

        SelectQuery distinct = new SelectQuery(ClobMaster.class);
        distinct.setDistinct(true);
        distinct.addOrdering(ClobMaster.NAME_PROPERTY, SortOrder.ASCENDING);

        List noDistinctResult = context.performQuery(noDistinct);
        List distinctResult = context.performQuery(distinct);

        assertEquals(3, noDistinctResult.size());
        assertEquals(noDistinctResult, distinctResult);
    }
View Full Code Here

        SelectQuery distinct = new SelectQuery(ClobMaster.class);
        distinct.setDistinct(true);
        distinct.addOrdering(ClobMaster.NAME_PROPERTY, SortOrder.ASCENDING);

        List noDistinctResult = context.performQuery(noDistinct);
        List distinctResult = context.performQuery(distinct);

        assertEquals(3, noDistinctResult.size());
        assertEquals(noDistinctResult, distinctResult);
    }
View Full Code Here

        DataContext context = createDataContext();

        Expression qual = Expression.fromString("details.name like 'cd%'");
        SelectQuery query = new SelectQuery(ClobMaster.class, qual);
        List result = context.performQuery(query);

        assertEquals(3, result.size());
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.