Package org.apache.tuscany.das.rdb

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


        Command select2 = das2.getCommand("select book 1");
        DataObject root2 = select2.executeQuery();
        DataObject book2 = root2.getDataObject("BOOK[1]");
        // Change a field to mark the instance 'dirty'
        book2.setInt("QUANTITY", 5);
        das2.applyChanges(root2);

        // Try to apply changes and catch the expecetd An update collision occurred
        try {
            das.applyChanges(root);
            fail("An OCCException should be thrown");
View Full Code Here


        // Change a field to mark the instance 'dirty'
        book.setInt("QUANTITY", 2);

        // Flush the change

        das.applyChanges(root);

        // Verify
        root = select.executeQuery();
        book = root.getDataObject("BOOK[1]");
        assertEquals(2, book.getInt("QUANTITY"));
View Full Code Here

        DataObject root = select.executeQuery();

        DataObject book = root.getDataObject("Book[2]");
        book.set("Writer", "Dr. Seuss");

        das.applyChanges(root);

        select = das.getCommand("get Cat in the Hat");

        root = select.executeQuery();
        // Ensure the change actually updated
View Full Code Here

        assertEquals("Fyodor Dostoevsky", root.getString("Book[1]/Writer"));

        DataObject bookToChange = root.getDataObject("Book[1]");
        bookToChange.set("Writer", "Fyodor Dostoevskii"); // His last name COULD be spelt like that too!

        das.applyChanges(root);

        // *******Verifys correct information in entry after a column data is changed
        select = das.getCommand("get all books");
        // select.setConnection(getConnection());

View Full Code Here

        }
        assertFalse(bookToChange == null);

        bookToChange.delete();

        das.applyChanges(root);

        // *******Verifys correct in table, after entry is deleted
        select = das.getCommand("get all books");
        // select.setConnection(getConnection());

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);

        root = select.executeQuery();

        // Verify
        select.setParameter(1, Integer.valueOf(1001));
View Full Code Here

        // Move an order to cust1 from cust2
        DataObject order = (DataObject) cust2.getList("orders").get(0);
        cust1.getList("orders").add(order);

        // Flush changes
        das.applyChanges(root);

        // verify cust1 relationship updates
        select = das
                .createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON "
                        + "CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?");
View Full Code Here

        DataObject company = root.getDataObject("COMPANY[1]");
        company.setDataObject("company->employee_opposite", null);
        assertNull(company.getDataObject("company->employee_opposite"));

        //Flush changes
        das.applyChanges(root);

        //Verify
        root = read.executeQuery();
        company = root.getDataObject("COMPANY[1]");
        assertNull(company.getDataObject("company->employee_opposite"));
View Full Code Here

        DataObject employee = company.getDataObject("company->employee_opposite");
        employee.delete();
        assertNull(company.getDataObject("company->employee_opposite"));

        //Flush changes
        das.applyChanges(root);

        //Verify
        root = read.executeQuery();
        company = root.getDataObject("COMPANY[1]");
        assertNull(company.getDataObject("company->employee_opposite"));
View Full Code Here

        //Strangely this statement results in "Could not find relationships" error
        //although "company.setDataObject("company->employee_opposite", null);" dos not  
        company.setDataObject("company->employee_opposite", employee);

        //Flush changes
        das.applyChanges(root);

        //Verify
        root = read.executeQuery();

        employee = root.getDataObject("COMPANY[1]/company->employee_opposite");
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.