Package org.apache.cayenne.query

Examples of org.apache.cayenne.query.SQLAction


        bindings.put("id", 201l);
        template.setParameters(bindings);

        // must ensure the right SQLTemplateAction is created

        SQLAction plan = adapter.getAction(template, node);
        assertTrue(plan instanceof SQLTemplateAction);

        MockOperationObserver observer = new MockOperationObserver();
        Connection c = dataSourceFactory.getSharedDataSource().getConnection();

        try {
            plan.performAction(c, observer);
        }
        finally {
            c.close();
        }
View Full Code Here


        Map<String, Object> bindings = new HashMap<String, Object>();
        bindings.put("id", 101);
        template.setParameters(bindings);

        SQLAction plan = adapter.getAction(template, node);

        MockOperationObserver observer = new MockOperationObserver();
        Connection c = dataSourceFactory.getSharedDataSource().getConnection();

        try {
            plan.performAction(c, observer);
        }
        finally {
            c.close();
        }
View Full Code Here

        Map<String, Object> bindings = new HashMap<String, Object>();
        bindings.put("id", 101);
        template.setParameters(bindings);

        SQLAction plan = adapter.getAction(template, node);

        MockOperationObserver observer = new MockOperationObserver();
        Connection c = dataSourceFactory.getSharedDataSource().getConnection();

        try {
            plan.performAction(c, observer);
        }
        finally {
            c.close();
        }
View Full Code Here

        Map<String, Object> bindings = new HashMap<String, Object>();
        bindings.put("id", 201);
        template.setParameters(bindings);

        SQLAction plan = adapter.getAction(template, node);

        MockOperationObserver observer = new MockOperationObserver();
        Connection c = dataSourceFactory.getSharedDataSource().getConnection();

        try {
            plan.performAction(c, observer);
        }
        finally {
            c.close();
        }
View Full Code Here

        bindings.put("id", new Long(1));
        bindings.put("name", "a1");
        bindings.put("dob", new Date(System.currentTimeMillis()));
        template.setParameters(bindings);

        SQLAction action = adapter.getAction(template, node);

        Connection c = dataSourceFactory.getSharedDataSource().getConnection();
        try {
            MockOperationObserver observer = new MockOperationObserver();
            action.performAction(c, observer);

            int[] batches = observer.countsForQuery(template);
            assertNotNull(batches);
            assertEquals(1, batches.length);
            assertEquals(1, batches[0]);
View Full Code Here

        SQLTemplate template = new SQLTemplate(
                Object.class,
                "delete from ARTIST where ARTIST_NAME like 'a%'");

        SQLAction action = adapter.getAction(template, node);

        Connection c = dataSourceFactory.getSharedDataSource().getConnection();
        try {
            MockOperationObserver observer = new MockOperationObserver();
            action.performAction(c, observer);

            int[] batches = observer.countsForQuery(template);
            assertNotNull(batches);
            assertEquals(1, batches.length);
            assertEquals(4, batches[0]);
View Full Code Here

        bindings2.put("dob", new Date(System.currentTimeMillis()));
        template.setParameters(new Map[] {
                bindings1, bindings2
        });

        SQLAction genericAction = adapter.getAction(template, node);
        assertTrue(genericAction instanceof SQLTemplateAction);
        SQLTemplateAction action = (SQLTemplateAction) genericAction;

        assertSame(adapter, action.getAdapter());
        assertSame(template, action.getQuery());
View Full Code Here

TOP

Related Classes of org.apache.cayenne.query.SQLAction

Copyright © 2018 www.massapicom. 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.