Package org.apache.cayenne.query

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


    }

    public void testDatabaseUnionCapabilities() {

        QueryChain inserts = new QueryChain();
        inserts
                .addQuery(new SQLTemplate(
                        SubEntity1.class,
                        "INSERT INTO INHERITANCE_SUB_ENTITY1 "
                                + "(ID, SUBENTITY_STRING_DB_ATTR, SUPER_INT_DB_ATTR, SUPER_STRING_DB_ATTR) "
                                + "VALUES (1, 'V11', 1, 'V21')"));
View Full Code Here


                        SubEntity1.class,
                        "INSERT INTO INHERITANCE_SUB_ENTITY1 "
                                + "(ID, SUBENTITY_STRING_DB_ATTR, SUPER_INT_DB_ATTR, SUPER_STRING_DB_ATTR) "
                                + "VALUES (1, 'V11', 1, 'V21')"));

        inserts
                .addQuery(new SQLTemplate(
                        SubEntity1.class,
                        "INSERT INTO INHERITANCE_SUB_ENTITY2 "
                                + "(ID, OVERRIDDEN_STRING_DB_ATTR, SUPER_INT_DB_ATTR, SUBENTITY_INT_DB_ATTR) "
                                + "VALUES (1, 'VX11', 101, 201)"));
View Full Code Here

    }

    public void testSelectQueryOnConcreteLeafEntity() {

        QueryChain inserts = new QueryChain();
        inserts
                .addQuery(new SQLTemplate(
                        SubEntity1.class,
                        "INSERT INTO INHERITANCE_SUB_ENTITY1 "
                                + "(ID, SUBENTITY_STRING_DB_ATTR, SUPER_INT_DB_ATTR, SUPER_STRING_DB_ATTR) "
                                + "VALUES (1, 'V11', 1, 'V21')"));
View Full Code Here

                .addQuery(new SQLTemplate(
                        SubEntity1.class,
                        "INSERT INTO INHERITANCE_SUB_ENTITY1 "
                                + "(ID, SUBENTITY_STRING_DB_ATTR, SUPER_INT_DB_ATTR, SUPER_STRING_DB_ATTR) "
                                + "VALUES (1, 'V11', 1, 'V21')"));
        inserts
                .addQuery(new SQLTemplate(
                        SubEntity1.class,
                        "INSERT INTO INHERITANCE_SUB_ENTITY1 "
                                + "(ID, SUBENTITY_STRING_DB_ATTR, SUPER_INT_DB_ATTR, SUPER_STRING_DB_ATTR) "
                                + "VALUES (2, 'V12', 2, 'V22')"));
View Full Code Here

    public void testUnrefreshingToOne() {

        ObjectContext context = createDataContext();

        QueryChain chain = new QueryChain();
        chain.addQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (1, 'a1')"));
        chain
                .addQuery(new SQLTemplate(
                        Painting.class,
View Full Code Here

        QueryChain chain = new QueryChain();
        chain.addQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (1, 'a1')"));
        chain
                .addQuery(new SQLTemplate(
                        Painting.class,
                        "INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE) VALUES (1, 1, 'p1')"));

        context.performQuery(chain);
View Full Code Here

    public void testRefreshingToOne() {

        ObjectContext context = createDataContext();

        QueryChain chain = new QueryChain();
        chain.addQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (1, 'a1')"));
        chain
                .addQuery(new SQLTemplate(
                        Painting.class,
View Full Code Here

        QueryChain chain = new QueryChain();
        chain.addQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (1, 'a1')"));
        chain
                .addQuery(new SQLTemplate(
                        Painting.class,
                        "INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE) VALUES (1, 1, 'p1')"));

        context.performQuery(chain);
View Full Code Here

  }

  static void mappingQueriesChapter(ObjectContext context) {

    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

  static void mappingQueriesChapter(ObjectContext context) {

    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

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.