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.
Commit failed for grid with SQLContainer as Datasource
Hello!
I have a grid and a SQLCOntainer as datasource for it. I need to enble row editing and saving changes to the database.
I did following steps:
grid.setEditorEnabled(true);
and find on forum those sort of listener:
grid.getEditorFieldGroup().addCommitHandler(new FieldGroup.CommitHandler() {
@Override
public void preCommit(FieldGroup.CommitEvent commitEvent) throws FieldGroup.CommitException {
//...
}
@Override
public void postCommit(FieldGroup.CommitEvent commitEvent) throws FieldGroup.CommitException {
//...
try {
dbhelp.container.commit();
//dbhelp.q.beginTransaction();
//dbhelp.q.commit();
} catch (UnsupportedOperationException | SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
and after i click "save" i got error:
com.vaadin.data.fieldgroup.FieldGroup$CommitException: Commit failed
and
Caused by: com.vaadin.data.util.sqlcontainer.OptimisticLockException: Someone else changed the row that was being updated.
q.setVersionColumn("upd_date");
upd_date is table in PostgreSQL with type timestamp with time zone and defult value set.
I would be much gratefull for the help!
Is there a possibility that someone else has in fact changed the data?
Also, check that you've done this: https://vaadin.com/docs/-/part/framework/sqlcontainer/sqlcontainer-editing.html#sqlcontainer.editing.version-column