Package org.apache.tuscany.das.rdb

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


        // Modify an order
        DataObject order = (DataObject) customer.get("orders[1]");
        order.setString("PRODUCT", "Kitchen Sink 001");

        das.applyChanges(root);

    }

}
View Full Code Here


        // Modify customer
        customer.set("LASTNAME", "Pavick");

        try {
            das.applyChanges(root);

            throw new Exception("Test Exception");

            // Since the DAS is not managing tx boundaries, I must
        } catch (Exception e) {
View Full Code Here

        assertEquals(lastName, root.getString("CUSTOMER[1]/LASTNAME"));

        // Try again
        customer = (DataObject) root.get("CUSTOMER[1]");
        customer.set("LASTNAME", "Pavick");
        das.applyChanges(root);
        c.commit();

        root = select.executeQuery();
        assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME"));
    }
View Full Code Here

        // Modify
        orderDetails.setFloat("PRICE", 0f);

        // Build apply changes command

        das.applyChanges(root);

        // Verify
        root = getOrderDetails.executeQuery();
        orderDetails = root.getDataObject("ORDERDETAILS[1]");
        assertEquals(0f, orderDetails.getFloat("PRICE"), 0.01);
View Full Code Here

        c.setID(4000);
        c.setLastName("Smith");
        c.setAddress("400 Fourth Street");

        DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());
        das.applyChanges(graph);

        Command cmd = das.createCommand("select * from CUSTOMER order by ID desc");
        graph = cmd.executeQuery();
        assertEquals(6, graph.getList("Customer").size());
        assertEquals("Smith", graph.getDataObject("Customer[1]").getString("lastName"));
View Full Code Here

        DataObject newBook = root.createDataObject("Book");
        newBook.setString("NAME", "Ant Colonies of the Old World");
        newBook.setInt("BOOK_ID", 1001);
        root.getList("Book").add(newBook);

        das.applyChanges(root);

        //Verify
        select.setParameter(1, Integer.valueOf(1001));
        root = select.executeQuery();
        assertEquals("Ant Colonies of the Old World", root.getString("Book[1]/NAME"));
View Full Code Here

        root = custOrders.executeQuery();

        // Modify the first order and flush this change back to the database
        root.setString("CUSTOMER[1]/orders[1]/PRODUCT", "Defibrillator");
        Integer orderId = (Integer) root.get("CUSTOMER[1]/orders[1]/ID");
        das.applyChanges(root);

        // Verify
        Command orderByID = das.getCommand("order by id");
        orderByID.setParameter(1, orderId);
        assertEquals("Defibrillator", root.getString("ANORDER[1]/PRODUCT"));
View Full Code Here

        DataObject root = getOrderDetails.executeQuery();

        DataObject orderDetail = (DataObject) root.get("ORDERDETAILS[1]");
        orderDetail.delete();
        das.applyChanges(root);

    }
}
View Full Code Here

        update.setParameter(1, new Integer(100));
        update.execute();

        // Try to apply changes and catch the expected An update collision occurred
        try {
            das.applyChanges(root);
            fail("An OCCException should be thrown");
        } catch (RuntimeException ex) {
            if (!ex.getMessage().equals("An update collision occurred")) {
                throw ex;
            }
View Full Code Here

        DataObject root = select.executeQuery();
        DataObject book = root.getDataObject("BOOK[1]");
        // Change a field to mark the instance 'dirty'
        book.setInt("QUANTITY", 2);
        int occValue = book.getInt("OCC");
        das.applyChanges(root);

        root = select.executeQuery();
        book = root.getDataObject("BOOK[1]");
        assertEquals(occValue + 1, book.getInt("OCC"));
    }
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.