Package org.apache.tuscany.das.rdb

Examples of org.apache.tuscany.das.rdb.Command.executeQuery()


                "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID", getConfig("CustomersOrdersConfig.xml"))
        select.setConnection(getConnection());
       
        select.setConnection(getConnection());
        select.setParameterValue("ID", new Integer(1));
        DataObject graph1 = select.executeQuery();
       
        DataObject customer = (DataObject)graph1.getList("CUSTOMER").get(0);
        assertEquals(2, customer.getList("orders").size());   
       
        select.setParameterValue("ID", new Integer(2));
View Full Code Here


       
        DataObject customer = (DataObject)graph1.getList("CUSTOMER").get(0);
        assertEquals(2, customer.getList("orders").size());   
       
        select.setParameterValue("ID", new Integer(2));
        DataObject graph2 = select.executeQuery();
        DataObject customer2 = (DataObject)graph2.getList("CUSTOMER").get(0);
        assertEquals(1, graph2.getList("CUSTOMER").size());
        assertEquals(1, customer2.getList("orders").size());
        assertEquals(2, customer2.getInt("ID"));
       
View Full Code Here

                "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID", getConfig("CustomersOrdersConfig.xml"))
        select.setConnection(getConnection());
       
        select.setConnection(getConnection());
        select.setParameterValue("ID", new Integer(1));
        DataObject graph1 = select.executeQuery();
       
        DataObject customer = (DataObject)graph1.getList("CUSTOMER").get(0);
        assertEquals(2, customer.getList("orders").size());
       
        Command select2 = Command.FACTORY.createCommand("select * from ANORDER");
View Full Code Here

        DataObject customer = (DataObject)graph1.getList("CUSTOMER").get(0);
        assertEquals(2, customer.getList("orders").size());
       
        Command select2 = Command.FACTORY.createCommand("select * from ANORDER");
        select2.setConnection(getConnection());
        DataObject graph2 = select2.executeQuery();
        assertEquals(4, graph2.getList("ANORDER").size());
       
        GraphMerger merger = new GraphMerger();
        merger.addPrimaryKey("CUSTOMER.ID");
        merger.addPrimaryKey("ANORDER.ID");
View Full Code Here

        // Parameterize the command
        selectCommand.setConnection(getConnection());

        // Get the graph
        DataObject root = selectCommand.executeQuery();

        // Get a company
        DataObject company = (DataObject) root.getList("CompanyType").get(0);
        assertEquals("MegaCorp", company.get("NAME"));
View Full Code Here

        // Parameterize the command
        selectCommand.setConnection(getConnection());
        selectCommand.setDataObjectModel(TypeHelper.INSTANCE.getType(DatagraphRoot.class));

        // Get the graph
        DatagraphRoot root = (DatagraphRoot) selectCommand.executeQuery();
       
       
        CompanyType company = (CompanyType) root.getCompanies().get(0);

        assertEquals("MegaCorp", company.getName());
View Full Code Here

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

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

    // Modify customer
    customer.set("LASTNAME", "Pavick");
View Full Code Here

  public void testInsertCUDGeneration() throws Exception {
    Command select = Command.FACTORY
        .createCommand("Select * from CUSTOMER where ID = 1");
    select.setConnection(getConnection());
    DataObject root = select.executeQuery();

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

    apply.execute(root);

    select = Command.FACTORY
        .createCommand("select * from CUSTOMER where ID = 720");
    select.setConnection(getConnection());
    root = select.executeQuery();

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

  public void testReadModifyApply() throws Exception {
View Full Code Here

    // Parameterize the command
    select.setConnection(getConnection());
    select.setParameterValue("ID", new Integer(1));

    // Get the graph
    DataObject root = select.executeQuery();

    // Modify a customer
    DataObject customer = (DataObject) root.get("Customer[1]");
    customer.set("LASTNAME", "Pavick");
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.