Package org.apache.cayenne

Examples of org.apache.cayenne.ObjectContext.performGenericQuery()


        deleteTestData();
    }

    public void testAliasPathSplits_SinglePath() {
        ObjectContext context = createDataContext();
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (1, 'AA')"));
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (2, 'BB')"));
View Full Code Here


    public void testAliasPathSplits_SinglePath() {
        ObjectContext context = createDataContext();
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (1, 'AA')"));
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (2, 'BB')"));

        context.performGenericQuery(new SQLTemplate(
                Artist.class,
View Full Code Here

                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (1, 'AA')"));
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (2, 'BB')"));

        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE) "
                        + "VALUES (1, 1, 'X')"));
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
View Full Code Here

        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE) "
                        + "VALUES (1, 1, 'X')"));
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE)"
                        + " VALUES (2, 2, 'Y')"));

        SelectQuery query = new SelectQuery(Artist.class);
View Full Code Here

        assertEquals("AA", artists.get(0).getArtistName());
    }

    public void testAliasPathSplits_SplitJoin() {
        ObjectContext context = createDataContext();
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (1, 'AA')"));
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (2, 'BB')"));
View Full Code Here

    public void testAliasPathSplits_SplitJoin() {
        ObjectContext context = createDataContext();
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (1, 'AA')"));
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (2, 'BB')"));

        context.performGenericQuery(new SQLTemplate(
                Artist.class,
View Full Code Here

                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (1, 'AA')"));
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (2, 'BB')"));

        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE) "
                        + "VALUES (1, 1, 'X')"));
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
View Full Code Here

        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE) "
                        + "VALUES (1, 1, 'X')"));
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE)"
                        + " VALUES (2, 2, 'Y')"));
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
View Full Code Here

                        + "VALUES (1, 1, 'X')"));
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE)"
                        + " VALUES (2, 2, 'Y')"));
        context.performGenericQuery(new SQLTemplate(
                Artist.class,
                "INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE)"
                        + " VALUES (3, 2, 'X')"));

        SelectQuery query = new SelectQuery(Artist.class);
View Full Code Here

        assertEquals(new Long(2l), notUpdated);

        String ejbql = "UPDATE Painting AS p SET p.paintingTitle = 'XX' WHERE p.paintingTitle = 'P1'";
        EJBQLQuery query = new EJBQLQuery(ejbql);

        QueryResponse result = context.performGenericQuery(query);

        int[] count = result.firstUpdateCount();
        assertNotNull(count);
        assertEquals(1, count.length);
        assertEquals(1, count[0]);
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.