Hi,
I’m trying to figure out how to implement the SQLContainer addItem() using the Vaadin Book!
However the description in the book is too brief to get it going sorry!
Please can anybody explain this topic in more detail?
I’ ve the following:
The MyTable table with a number as primary key field PK, a textfield column, and an OPTLOCK timestamp column, nothing more. Just to keep it very basic, okay!
The query is implemented using the TableQuery like:
TableQuery tq = new TableQuery("MyTable",connectionPool,og);
tq.setVersionColumn("OPTLOCK");
Next comes the SQLContainer:
SQLContainer sqlC = new SQLContainer(tq);
The sqlC instance defines a listener like:
sqlC.addRowIdChangeListener(new RowIdChangeListener() {
public void rowIdChange(RowIdChangeEvent event) {
System.ouit.println("Old ID: " + event.getOldRowId());
System.out.println("New ID: " + event.getNewRowId());
}
});
Next I use:
sqlC.addItem();
sqlC.commit();
Now I’ d expect to obtain the actual primary key value of the newly insert row in the MyTable! However all I get is a NullpointerException, but why!?
Regards,
Gerard