I'm very new to vaadin ( and to java).
i have an table that has an SQLcontainer like so :
public class ProjectTable extends Table {
public ProjectTable(final DocumentmanagerApplication app) {
setSizeFull();
setContainerDataSource(app.getDbHelp().getProjectContainer());
setImmediate(true);
commit();
setSelectable(true);
}
}
i have a button and a TextField , to fill data in the table
public void buttonClick(ClickEvent event)
{
SQLContainer cont = h.getAssetContainer();
String dataResult = tf.getValue().toString(); // TEXT FIELD
System.out.println(dataResult);
Object itemId = cont.addItem(); // cont is the container
**cont.getContainerProperty(itemId , "id").setValue(dataResult); // BUG IS HERE !!! **
try {
cont.commit();
} catch (UnsupportedOperationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
i keep getting a " null pointer exception" no matter what i do. on the line **cont.getContainerProperty(itemId , "id").setValue(dataResult);
am i doing anything wrong ? and what is null pointer ?
please inform me if anything was unclear.
please help , thanks in advance.