Examples of ProcedureQuery


Examples of org.apache.cayenne.query.ProcedureQuery

        // create an artist with painting in the database
        createArtist(1000.0);

        // test ProcedureQuery with Procedure as root
        Procedure proc = context.getEntityResolver().getProcedure(SELECT_STORED_PROCEDURE);
        ProcedureQuery q = new ProcedureQuery(proc);
        q.setFetchingDataRows(true);
        q.addParameter("aName", "An Artist");
        q.addParameter("paintingPrice", new Integer(3000));

        // TESTING THIS ***
        // A.ARTIST_ID, A.DATE_OF_BIRTH, A.ARTIST_NAME
        ColumnDescriptor[] columns = new ColumnDescriptor[3];

        // read ID as Long, and everything else as default types
        columns[0] = new ColumnDescriptor("ARTIST_ID", Types.BIGINT);
        columns[1] = new ColumnDescriptor("ARTIST_NAME", Types.CHAR);
        columns[2] = new ColumnDescriptor("DATE_OF_BIRTH", Types.DATE);
        q.addResultDescriptor(columns);

        List<?> rows = runProcedureSelect(q);

        // check the results
        assertNotNull("Null result from StoredProcedure.", rows);
View Full Code Here

Examples of org.apache.cayenne.query.ProcedureQuery

        if (!(query instanceof ProcedureQuery)) {
            setVisible(false);
            return;
        }

        ProcedureQuery procedureQuery = (ProcedureQuery) query;

    
        properties.setEnabled(true);
        name.setText(procedureQuery.getName());

        // init root choices and title label..

        // - ProcedureQuery supports Procedure roots

        // TODO: now we only allow roots from the current map,
        // since query root is fully resolved during map loading,
        // making it impossible to reference other DataMaps.

        DataMap map = mediator.getCurrentDataMap();
        Object[] roots = map.getProcedures().toArray();

        if (roots.length > 1) {
            Arrays.sort(roots, Comparators.getDataMapChildrenComparator());
        }

        DefaultComboBoxModel model = new DefaultComboBoxModel(roots);
        model.setSelectedItem(procedureQuery.getRoot());
        queryRoot.setModel(model);

        properties.initFromModel(procedureQuery);
        setVisible(true);
    }
View Full Code Here

Examples of org.apache.cayenne.query.ProcedureQuery

    }

    void setEntity(ObjEntity entity) {
        Query query = mediator.getCurrentQuery();
        if (query instanceof ProcedureQuery) {
            ProcedureQuery procedureQuery = (ProcedureQuery) query;

            procedureQuery.setResultEntityName(entity != null ? entity.getName() : null);
            mediator.fireQueryEvent(new QueryEvent(this, procedureQuery));
        }
    }
View Full Code Here

Examples of org.apache.cayenne.query.ProcedureQuery

    protected AbstractQuery selectedQuery;

    public QueryTypeModel(DataMap root) {
        // create query prototypes:
        objectSelectQuery = new SelectQuery();
        procedureQuery = new ProcedureQuery();

        SQLTemplate rawSQLQuery = new SQLTemplate();
        rawSQLQuery.setRoot(root);
        rawSQLQuery.setFetchingDataRows(true);
        this.rawSQLQuery = rawSQLQuery;
View Full Code Here

Examples of org.apache.cayenne.query.ProcedureQuery

    protected Query selectedQuery;

    public QueryTypeModel(DataMap root) {
        // create query prototypes:
        objectSelectQuery = new SelectQuery();
        procedureQuery = new ProcedureQuery();

        SQLTemplate rawSQLQuery = new SQLTemplate();
        rawSQLQuery.setRoot(root);
        rawSQLQuery.setFetchingDataRows(true);
        this.rawSQLQuery = rawSQLQuery;
View Full Code Here

Examples of org.apache.cayenne.query.ProcedureQuery

        if (!(query instanceof ProcedureQuery)) {
            setVisible(false);
            return;
        }

        ProcedureQuery procedureQuery = (ProcedureQuery) query;

    
        properties.setEnabled(true);
        name.setText(procedureQuery.getName());

        // init root choices and title label..

        // - ProcedureQuery supports Procedure roots

        // TODO: now we only allow roots from the current map,
        // since query root is fully resolved during map loading,
        // making it impossible to reference other DataMaps.

        DataMap map = mediator.getCurrentDataMap();
        Object[] roots = map.getProcedures().toArray();

        if (roots.length > 1) {
            Arrays.sort(roots, Comparators.getDataMapChildrenComparator());
        }

        DefaultComboBoxModel model = new DefaultComboBoxModel(roots);
        model.setSelectedItem(procedureQuery.getRoot());
        queryRoot.setModel(model);

        properties.initFromModel(procedureQuery);
        setVisible(true);
    }
View Full Code Here

Examples of org.apache.cayenne.query.ProcedureQuery

    }

    void setEntity(ObjEntity entity) {
        Query query = mediator.getCurrentQuery();
        if (query instanceof ProcedureQuery) {
            ProcedureQuery procedureQuery = (ProcedureQuery) query;

            procedureQuery.setResultEntityName(entity != null ? entity.getName() : null);
            mediator.fireQueryEvent(new QueryEvent(this, procedureQuery));
        }
    }
View Full Code Here

Examples of org.apache.cayenne.query.ProcedureQuery

        public void initFromModel(Query query) {
            super.initFromModel(query);

            if (query instanceof ProcedureQuery) {
                ProcedureQuery template = (ProcedureQuery) query;
                DefaultComboBoxModel labelCaseModel = new DefaultComboBoxModel(
                        LABEL_CAPITALIZATION);

                labelCaseModel.setSelectedItem(template.getColumnNamesCapitalization());
                labelCase.setModel(labelCaseModel);
            }
        }
View Full Code Here

Examples of org.apache.cayenne.query.ProcedureQuery

        }

        // create an artist with painting in the database
        createArtist(1000.0);

        ProcedureQuery q = new ProcedureQuery(UPDATE_STORED_PROCEDURE);
        q.addParameter("paintingPrice", new Integer(3000));

        // since stored procedure commits its stuff, we must use an explicit
        // non-committing transaction

        Transaction t = Transaction.externalTransaction(null);
View Full Code Here

Examples of org.apache.cayenne.query.ProcedureQuery

        }

        // create an artist with painting in the database
        createArtist(1000.0);

        ProcedureQuery q = new ProcedureQuery(UPDATE_STORED_PROCEDURE_NOPARAM);

        // since stored procedure commits its stuff, we must use an explicit
        // non-committing transaction

        Transaction t = Transaction.externalTransaction(null);
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.