Package com.vaadin.data.util.sqlcontainer

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


                    for (int cent = 0; cent < cents; cent++) {
                        TableQuery q = new TableQuery("AUTHOR", pool);
                        q.setVersionColumn("ID");
                        SQLContainer c = new SQLContainer(q);
                        for (int i = 0; i < 100; i++) {
                            Object id = c.addItem();
                            c.getContainerProperty(id, "FIRST_NAMES").setValue(
                                    getRandonName());
                            c.getContainerProperty(id, "LAST_NAME").setValue(
                                    getRandonName());
                        }
View Full Code Here


        }
        SQLGenerator sg = new DefaultSQLGenerator();
        TableQuery query = new TableQuery("people", connectionPool);
        SQLContainer container = new SQLContainer(query);

        RowItem ri = (RowItem) container.getItem(container.addItem());
        ri.getItemProperty("NAME").setValue("Viljami");

        StatementHelper sh = sg.generateInsertQuery("people", ri);

        Assert.assertTrue("INSERT INTO people (\"NAME\", \"AGE\") VALUES (?, ?)"
View Full Code Here

        tQuery.setVersionColumn("ID");

        SQLContainer container = new SQLContainer(tQuery);
        container.setAutoCommit(false);

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

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

    public void storeRow_noVersionColumn_shouldSucceed()
            throws UnsupportedOperationException, SQLException {
        TableQuery tQuery = new TableQuery("people", connectionPool,
                SQLTestsConstants.sqlGen);
        SQLContainer container = new SQLContainer(tQuery);
        Object id = container.addItem();
        RowItem row = (RowItem) container.getItem(id);
        row.getItemProperty("NAME").setValue("R2D2");
        row.getItemProperty("AGE").setValue(123);
        tQuery.beginTransaction();
        tQuery.storeRow(row);
View Full Code Here

            // 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.