Package org.apache.cayenne.query

Examples of org.apache.cayenne.query.QueryChain.addQuery()


    QueryChain chain = new QueryChain();
    chain.addQuery(new NamedQuery("DeleteAll", Collections.singletonMap(
        "table", "PAINTING")));
    chain.addQuery(new NamedQuery("DeleteAll", Collections.singletonMap(
        "table", "ARTIST")));
    chain.addQuery(new NamedQuery("DeleteAll", Collections.singletonMap(
        "table", "GALLERY")));

    context.performGenericQuery(chain);

  }
View Full Code Here


    }

    static void mappingQueriesChapter(DataContext context) {

        QueryChain chain = new QueryChain();
        chain.addQuery(new NamedQuery("DeleteAll", Collections.singletonMap(
                "table",
                "PAINTING")));
        chain.addQuery(new NamedQuery("DeleteAll", Collections.singletonMap(
                "table",
                "ARTIST")));
View Full Code Here

        QueryChain chain = new QueryChain();
        chain.addQuery(new NamedQuery("DeleteAll", Collections.singletonMap(
                "table",
                "PAINTING")));
        chain.addQuery(new NamedQuery("DeleteAll", Collections.singletonMap(
                "table",
                "ARTIST")));
        chain.addQuery(new NamedQuery("DeleteAll", Collections.singletonMap(
                "table",
                "GALLERY")));
View Full Code Here

                "table",
                "PAINTING")));
        chain.addQuery(new NamedQuery("DeleteAll", Collections.singletonMap(
                "table",
                "ARTIST")));
        chain.addQuery(new NamedQuery("DeleteAll", Collections.singletonMap(
                "table",
                "GALLERY")));

        context.performGenericQuery(chain);
View Full Code Here

        QueryChain chain = new QueryChain();

        if (object instanceof Collection) {
            Iterator it = ((Collection) object).iterator();
            while (it.hasNext()) {
                chain.addQuery(processQuery((Query) it.next(), parameters));
            }
        }
        else if (object instanceof Query) {
            chain.addQuery(processQuery((Query) object, parameters));
        }
View Full Code Here

            while (it.hasNext()) {
                chain.addQuery(processQuery((Query) it.next(), parameters));
            }
        }
        else if (object instanceof Query) {
            chain.addQuery(processQuery((Query) object, parameters));
        }
        else {
            throw new RuntimeException("Invalid object type for name '"
                    + testName
                    + "': "
View Full Code Here

        Artist a1 = context.newObject(Artist.class);
        a1.setArtistName("X");
        context.commitChanges();

        QueryChain chain = new QueryChain();
        chain.addQuery(new SelectQuery(Artist.class));
        chain.addQuery(new SelectQuery(Artist.class));

        QueryResponse r = context.performGenericQuery(chain);

        // data comes back as datarows
View Full Code Here

        a1.setArtistName("X");
        context.commitChanges();

        QueryChain chain = new QueryChain();
        chain.addQuery(new SelectQuery(Artist.class));
        chain.addQuery(new SelectQuery(Artist.class));

        QueryResponse r = context.performGenericQuery(chain);

        // data comes back as datarows
        assertEquals(2, r.size());
View Full Code Here

    public void testTRIM() {

        // insert via a SQL template to prevent adapter trimming and such...
        QueryChain inserts = new QueryChain();
        inserts.addQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID,ARTIST_NAME) VALUES(1, '  A')"));
        inserts.addQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID,ARTIST_NAME) VALUES(2, 'A  ')"));
View Full Code Here

        // insert via a SQL template to prevent adapter trimming and such...
        QueryChain inserts = new QueryChain();
        inserts.addQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID,ARTIST_NAME) VALUES(1, '  A')"));
        inserts.addQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID,ARTIST_NAME) VALUES(2, 'A  ')"));
        context.performGenericQuery(inserts);

        Artist a1 = Cayenne.objectForPK(context, Artist.class, 1);
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.