Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Can't save new rows via Grid
I've a Grid with the editor enabled.
DateField df_tmp = new DateField();
df_tmp.setConverter(new DateToTimestampConverter());
Grid g = new Grid();
g.setContainerDataSource(someSQLContainerFromOracle);
g.setEditorEnabled(true);
g.getColumn("ORACLE_DATE").setEditorField(df_tmp);
I've a button which adds another row to the grid:
Button save = new Button("Add");
save.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
getOverview().editItem(getOverview().addRow(new java.sql.Timestamp(new Date().getTime())));
}
});
`GetOverview()` returns the describe Grid.
As I click this button, a new row is generated and starts automatically in "Edit" mode since `addRow()` returns the generated `ItemId` as a parameter to `editItem()`.
I add a new row edited it a little bit and hit save. The problem is that this new data-set never reaches the database even though there is no exception thrown. There are a few things to hold in mind:
- The Grid doesn't update any item
It provides each data-set from the table but doesn't update any of it. It's changeable without an exception but the changes never reach the database.
- The UI isn't updated
As one row is changed and saved, the view remains the same. However, if you edit this data-set again, you're provided with the updated fields.
- A commit is made
I'm able to provoke a `commit()` exception if I don't use a custom converter for the DateField (`df_tmp.setConverter(newDate(...))`). So we can suggest that a commit is executed.
- The primary key is updated via a trigger
Thus I don't provide a key with `addRow()`.