Examples of SQLResult


Examples of org.apache.cayenne.map.SQLResult

        EntityResult artistResult = new EntityResult(Artist.class);
        artistResult.addDbField(Artist.ARTIST_ID_PK_COLUMN, "X");
        artistResult.addObjectField(Artist.ARTIST_NAME_PROPERTY, "Y");
        artistResult.addObjectField(Artist.DATE_OF_BIRTH_PROPERTY, "Z");

        SQLResult rsMap = new SQLResult();
        rsMap.addEntityResult(artistResult);
        rsMap.addColumnResult("C");
        query.setResult(rsMap);

        List<?> objects = context.performQuery(query);
        assertEquals(4, objects.size());
View Full Code Here

Examples of org.apache.cayenne.map.SQLResult

        query.setTemplate(
                OpenBaseAdapter.class.getName(),
                "SELECT COUNT(ARTIST_ID) X FROM ARTIST");
        query.setColumnNamesCapitalization(CapsStrategy.UPPER);

        SQLResult rsMap = new SQLResult();
        rsMap.addColumnResult("X");
        query.setResult(rsMap);

        List<?> objects = context.performQuery(query);
        assertEquals(1, objects.size());
View Full Code Here

Examples of org.apache.cayenne.map.SQLResult

        query.setTemplate(
                OpenBaseAdapter.class.getName(),
                "SELECT COUNT(ARTIST_ID) X, 77 Y FROM ARTIST GROUP BY 77");
        query.setColumnNamesCapitalization(CapsStrategy.UPPER);

        SQLResult rsMap = new SQLResult();
        rsMap.addColumnResult("X");
        rsMap.addColumnResult("Y");
        query.setResult(rsMap);

        List<?> objects = context.performQuery(query);
        assertEquals(1, objects.size());
View Full Code Here

Examples of org.apache.cayenne.map.SQLResult

        query.setTemplate(
                OpenBaseAdapter.class.getName(),
                "SELECT COUNT(ARTIST_ID) AS X FROM ARTIST");
        query.setColumnNamesCapitalization(CapsStrategy.UPPER);

        SQLResult rsMap = new SQLResult();
        rsMap.addColumnResult("X");
        query.setResult(rsMap);

        Object object = Cayenne.objectForQuery(context, query);
        assertNotNull(object);
        assertTrue(object instanceof Number);
View Full Code Here

Examples of org.apache.cayenne.map.SQLResult

        compiled.setRootId(rootId);
        compiled.setDescriptorsById(descriptorsById);
        compiled.setIncomingById(incomingById);

        if (resultComponents != null) {
            SQLResult mapping = new SQLResult();

            for (int i = 0; i < resultComponents.size(); i++) {
                Object nextMapping = resultComponents.get(i);
                if (nextMapping instanceof String) {
                    mapping.addColumnResult((String) nextMapping);
                }
                else if (nextMapping instanceof EJBQLExpression) {
                    mapping.addEntityResult(compileEntityResult(
                            (EJBQLExpression) nextMapping,
                            i));
                }
            }
View Full Code Here

Examples of org.apache.cayenne.map.SQLResult

        compiled.setDescriptorsById(descriptorsById);
        compiled.setIncomingById(incomingById);
        compiled.setPrefetchTree(prefetchTree);
       
        if (resultComponents != null) {
            SQLResult mapping = new SQLResult();

            for (int i = 0; i < resultComponents.size(); i++) {
                Object nextMapping = resultComponents.get(i);
                if (nextMapping instanceof String) {
                    mapping.addColumnResult((String) nextMapping);
                }
                else if (nextMapping instanceof EJBQLExpression) {
                    EntityResult compileEntityResult = compileEntityResult(
                            (EJBQLExpression) nextMapping,
                            i);
                    if (prefetchTree != null) {
                        for (PrefetchTreeNode prefetch : prefetchTree.getChildren()) {
                            if (((EJBQLExpression) nextMapping).getText().equals(
                                    prefetch.getEjbqlPathEntityId())) {
                                EJBQLIdentifier ident = new EJBQLIdentifier(0);
                                ident.text = prefetch.getEjbqlPathEntityId()
                                        + "."
                                        + prefetch.getPath();

                                compileEntityResult = compileEntityResultWithPrefetch(
                                        compileEntityResult,
                                        ident);

                            }
                        }
                    }
                    mapping.addEntityResult(compileEntityResult);
                   
                }
            }

            compiled.setResult(mapping);
View Full Code Here

Examples of org.apache.cayenne.map.SQLResult

        compiled.setRootId(rootId);
        compiled.setDescriptorsById(descriptorsById);
        compiled.setIncomingById(incomingById);

        if (resultComponents != null) {
            SQLResult mapping = new SQLResult();

            for (int i = 0; i < resultComponents.size(); i++) {
                Object nextMapping = resultComponents.get(i);
                if (nextMapping instanceof String) {
                    mapping.addColumnResult((String) nextMapping);
                }
                else if (nextMapping instanceof EJBQLExpression) {
                    mapping.addEntityResult(compileEntityResult(
                            (EJBQLExpression) nextMapping,
                            i));
                }
            }
View Full Code Here

Examples of org.apache.cayenne.map.SQLResult

        EntityResult artistResult = new EntityResult(Artist.class);
        artistResult.addDbField(Artist.ARTIST_ID_PK_COLUMN, "X");
        artistResult.addObjectField(Artist.ARTIST_NAME_PROPERTY, "Y");
        artistResult.addObjectField(Artist.DATE_OF_BIRTH_PROPERTY, "Z");

        SQLResult rsMap = new SQLResult();
        rsMap.addEntityResult(artistResult);
        rsMap.addColumnResult("C");
        query.setResult(rsMap);

        List objects = createDataContext().performQuery(query);
        assertEquals(4, objects.size());
View Full Code Here

Examples of org.apache.cayenne.map.SQLResult

        query.setTemplate(
                OpenBaseAdapter.class.getName(),
                "SELECT COUNT(ARTIST_ID) X FROM ARTIST");
        query.setColumnNamesCapitalization(CapsStrategy.UPPER);

        SQLResult rsMap = new SQLResult();
        rsMap.addColumnResult("X");
        query.setResult(rsMap);

        List objects = createDataContext().performQuery(query);
        assertEquals(1, objects.size());
View Full Code Here

Examples of org.apache.cayenne.map.SQLResult

        query.setTemplate(
                OpenBaseAdapter.class.getName(),
                "SELECT COUNT(ARTIST_ID) X, 77 Y FROM ARTIST GROUP BY 77");
        query.setColumnNamesCapitalization(CapsStrategy.UPPER);

        SQLResult rsMap = new SQLResult();
        rsMap.addColumnResult("X");
        rsMap.addColumnResult("Y");
        query.setResult(rsMap);

        List objects = createDataContext().performQuery(query);
        assertEquals(1, objects.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.