Package org.apache.tuscany.das.rdb

Examples of org.apache.tuscany.das.rdb.DAS.createCommand()


        super.tearDown();
    }

    public void testReadTableInfo() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command select = das.createCommand("SELECT * from SYSIBM.SYSTABLES WHERE TYPE = 'T'");
        DataObject root = select.executeQuery();

        DataObject table = (DataObject) root.get("SYSTABLES[1]");

        assertEquals('T', table.getChar("TYPE"));
View Full Code Here


     * config associaed with the applychanges command
     */
    public void test1() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        // Read a book instance
        Command select = das.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1");
        DataObject root = select.executeQuery();

        DataObject book = root.getDataObject("BOOK[1]");
        // Change a field to mark the instance 'dirty'
        book.setInt("QUANTITY", 2);
View Full Code Here

        ConfigHelper helper = new ConfigHelper();
        helper.addPrimaryKey("BOOK.BOOK_ID");
        DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());

        // Read a book instance
        Command select = das.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1");
        DataObject root = select.executeQuery();
        DataObject book = root.getDataObject("BOOK[1]");
        // Change a field to mark the instance 'dirty'
        book.setInt("QUANTITY", 2);

View Full Code Here

        // Read some customers and related orders
        // Create relationship config programmatically
        ConfigHelper helper = new ConfigHelper();
        helper.addRelationship("CUSTOMER.ID", "ANORDER.CUSTOMER_ID");
        DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());
        Command select = das.createCommand(statement);

        DataObject root = select.executeQuery();
        DataObject customer = root.getDataObject("CUSTOMER[1]");

        assertEquals(2, customer.getList("ANORDER").size());
View Full Code Here

    public void testSimple() throws Exception {

        DAS das = DAS.FACTORY.createDAS(getConfig("companyMapping.xml"), getConnection());

        // Build the select command
        Command selectCommand = das.createCommand("select COMPANY.NAME, "
                + "EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, "
                + "DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.DEPNUMBER from COMPANY, DEPARTMENT, EMPLOYEE "
                + "where COMPANY.ID=DEPARTMENT.COMPANYID and DEPARTMENT.ID=EMPLOYEE.DEPARTMENTID");

        // Get the graph
View Full Code Here

    public void testSimpleStatic() throws Exception {

        DAS das = DAS.FACTORY.createDAS(getConfig("companyMappingWithConverters.xml"), getConnection());
        SDOUtil.registerStaticTypes(CompanyFactory.class);
        // Build the select command
        Command selectCommand = das.createCommand("select COMPANY.NAME, "
                + "EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, "
                + "DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.DEPNUMBER from COMPANY, DEPARTMENT, EMPLOYEE "
                + "where COMPANY.ID=DEPARTMENT.COMPANYID and DEPARTMENT.ID=EMPLOYEE.DEPARTMENTID");

        // Get the graph
View Full Code Here

     */
    public void testCUDGeneration1() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithInvalidCUD.xml"), getConnection());

        // Read customer with particular ID
        Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
        DataObject root = select.executeQuery();

        DataObject customer = (DataObject) root.get("CUSTOMER[1]");

        // Modify customer
View Full Code Here

    }

    public void testInsertCUDGeneration() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConnection());

        Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
        DataObject root = select.executeQuery();

        DataObject customer = root.createDataObject("CUSTOMER");
        customer.setInt("ID", 720);
        customer.set("LASTNAME", "foobar");
View Full Code Here

        customer.set("LASTNAME", "foobar");
        customer.set("ADDRESS", "asdfasdf");

        das.applyChanges(root);

        select = das.createCommand("select * from CUSTOMER where ID = 720");
        root = select.executeQuery();

        assertEquals(1, root.getList("CUSTOMER").size());
    }

View Full Code Here

        DAS das = DAS.FACTORY.createDAS(getConfig("1xM_mapping_no_cud.xml"), getConnection());

        // Build the select command to read a specific customer and related
        // orders
        Command select = das.createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON "
                + "CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?");

        // Parameterize the command
        select.setParameter(1, Integer.valueOf(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.