Need help with Vaadin and Oracle Packages

Hello! I am new to this forum and also a new learner of this framework.
I have an oracle 10g database and I decided to select the data from tables using plsql procedures. What i don`t know is how to bind the result set obtained in java with the container to put selected data into a table in vaadin interface.
I get the result set like:

  • USERI = oracle package
  • GET_USERI = procedure in the package

[code]
ConnectionPool pool=new ConnectionPool();
Connection conn=pool.get_connection();
ResultSet rs = null;
if (conn != null){

        CallableStatement stmt = conn.prepareCall("{call USERI.GET_USERI(?)}");
        stmt.registerOutParameter(1, OracleTypes.CURSOR);
        stmt.execute();
        rs = (ResultSet) stmt.getObject(1);
        while (rs.next()) {
            new Notification(rs.getString(1),"",
                    Notification.TYPE_WARNING_MESSAGE, true)
                    .show(Page.getCurrent());
            }
        stmt.close();
        conn.close();
        
    }

[/code]Now my data is in the resultset.
I have the table and “data” as the (empty) datasource:

 t = new Table();
 t.setSizeFull();
        t.addStyleName("borderless");
        t.setSelectable(true);
        t.setColumnCollapsingAllowed(true);
        t.setColumnReorderingAllowed(true);
        //data.removeAllContainerFilters();
       // t.setContainerDataSource(data);
        sortTable();
        t.setVisibleColumns(new Object[] { "Cont", "Nume", "Prenume" });
        t.setDragMode(TableDragMode.MULTIROW);
        t.setMultiSelect(true);

How to insert data obtained from the resultset “rs” into the container “data”? Or, how to do it to fill the table with the selected data and also benefit from the vaadin framework magic interface capabilities? Thank you!

What type of container is ‘data’? Have you initialized it somewhere? The basic way to set this up is that you create an IndexedContainer. Add all the properties with addContainerProperty(String name, Object type, Object defaultValue); to it, then you loop over resultset with a while as you have there. Within the while, you first create an item and then populate the item with the properties from the resultset.

Pseudo-code written directly into forum without checking API:

IndexedContainer container = new IndexedContainer();
container.addContainerProperty("Username", String.class, null);
container.addContainerProperty("Name", String.class, null);
container.addContainerProperty("E-mail", String.class, null);
...
while(rs.next()){
  Item item = container.addItem(rs.getString("Username"));
  item.getItemProperty("Username").setValue("rs.getString("Username");
  item.getItemProperty("Name").setValue("rs.getString("Name");
  item.getItemProperty("E-mail").setValue("rs.getString("E-mail");
}
t.setContainerDataSource(container);