Package org.apache.tuscany.das.rdb

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


        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 (OptimisticConcurrencyException 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

        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, new Integer(1001));
View Full Code Here

        Command update = das.createCommand("update CUSTOMER set LASTNAME = 'modified' where ID = 1");
        update.execute();

        customer.setString("ADDRESS", "main street");

        das.applyChanges(root);

        root = readCustomers.executeQuery();

        // If partial update was not used, LASTNAME would not be 'modified'
        customer = root.getDataObject("CUSTOMER[1]");
View Full Code Here

        assertEquals(1, customer.getInt("ID"));

        customer.setString("LASTNAME", "lastname modified");
        customer.setString("ADDRESS", "address modified");
       
        das.applyChanges(root);

        root = readCustomers.executeQuery();

        // If partial update was not used, LASTNAME would not be 'modified'
        customer = root.getDataObject("CUSTOMER[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.