Package com.vaadin.data.util.sqlcontainer

Examples of com.vaadin.data.util.sqlcontainer.SQLContainer.commit()


                            c.getContainerProperty(id, "FIRST_NAMES").setValue(
                                    getRandonName());
                            c.getContainerProperty(id, "LAST_NAME").setValue(
                                    getRandonName());
                        }
                        c.commit();
                        getContext().lock();
                        try {
                            proggress
                                    .setValue(new Float((1.0f * cent) / cents));
                            proggress.setCaption("" + 100 * cent
 
View Full Code Here


        Assert.assertTrue(container.removeItem(container.getItemIds()
                .iterator().next()));

        Assert.assertEquals(4, tQuery.getCount());
        Assert.assertEquals(3, container.size());
        container.commit();

        Assert.assertEquals(3, tQuery.getCount());
        Assert.assertEquals(3, container.size());
    }
View Full Code Here

        Object item = container.addItem();
        Assert.assertNotNull(item);

        Assert.assertEquals(4, tQuery.getCount());
        Assert.assertEquals(5, container.size());
        container.commit();

        Assert.assertEquals(5, tQuery.getCount());
        Assert.assertEquals(5, container.size());
    }
View Full Code Here

        RowItem ri = (RowItem) item;
        Assert.assertNotNull(ri.getItemProperty("NAME"));
        ri.getItemProperty("NAME").setValue("Viljami");

        container.commit();

        // Check that the size is still correct and only 1 'Viljami' is found
        Assert.assertEquals(4, tQuery.getCount());
        Assert.assertEquals(4, container.size());
        tQuery.setFilters(filters);
View Full Code Here

        SQLContainer container = new SQLContainer(tQuery);
        RowItem row = (RowItem) container.getItem(container.firstItemId());
        Assert.assertEquals("Junk", row.getItemProperty("TEXT").getValue());

        row.getItemProperty("TEXT").setValue("asdf");
        container.commit();

        Connection conn = connectionPool.reserveConnection();
        PreparedStatement stmt = conn
                .prepareStatement("SELECT * FROM VERSIONED WHERE \"TEXT\" = ?");
        stmt.setString(1, "asdf");
View Full Code Here

        stmt.executeUpdate();
        stmt.close();
        conn.commit();
        connectionPool.releaseConnection(conn);

        container.commit();
    }

    @Test
    public void removeRow_versionSetAndEqualToDBValue_shouldSucceed()
            throws SQLException {
View Full Code Here

        SQLContainer container = new SQLContainer(tQuery);
        RowItem row = (RowItem) container.getItem(container.firstItemId());
        Assert.assertEquals("Junk", row.getItemProperty("TEXT").getValue());

        container.removeItem(container.firstItemId());
        container.commit();

        Connection conn = connectionPool.reserveConnection();
        PreparedStatement stmt = conn
                .prepareStatement("SELECT * FROM VERSIONED WHERE \"TEXT\" = ?");
        stmt.setString(1, "Junk");
View Full Code Here

        stmt.close();
        conn.commit();
        connectionPool.releaseConnection(conn);

        container.removeItem(container.firstItemId());
        container.commit();
    }

    @Test
    public void removeRow_throwsOptimisticLockException_shouldStillWork()
            throws SQLException {
View Full Code Here

        connectionPool.releaseConnection(conn);

        Object itemToRemove = container.firstItemId();
        try {
            container.removeItem(itemToRemove);
            container.commit();
        } catch (OptimisticLockException e) {
            // This is expected, refresh and try again.
            container.rollback();
            container.removeItem(itemToRemove);
            container.commit();
View Full Code Here

            container.commit();
        } catch (OptimisticLockException e) {
            // This is expected, refresh and try again.
            container.rollback();
            container.removeItem(itemToRemove);
            container.commit();
        }
        Object id = container.addItem();
        RowItem item = (RowItem) container.getItem(id);
        item.getItemProperty("TEXT").setValue("foo");
        container.commit();
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.