Hi !
I’m using a Grid with an SQLContainer for the binding. Everything works well. But when clicking Save from inline editing it throws a NullPointerException in FieldGroup.commitTransactions(). For some reason the getPropertyDataSource() for each field is null.
private void commitTransactions() {
for (Field<?> f : fieldToPropertyId.keySet()) {
((Property.Transactional<?>) f.getPropertyDataSource()).commit();
}
}
To be able to commit the change to the database I added a commit() inside the postCommit() of the FieldGroup handler. Commit works fine, database is updated and UI refreshed. But I have a NullPointerException in commitTransaction.
But without the commit getPropertyDataSource() is not null in FieldGroup.commitTransactions(). This only occurs when I put the container commit() method inside the postCommit() method. It seems to mess with the property data source…
FieldGroup binder = grid.getEditorFieldGroup();
binder.addCommitHandler(new CommitHandler() {
@Override
public void preCommit(CommitEvent commitEvent)
throws CommitException {
}
@Override
public void postCommit(CommitEvent commitEvent)
throws CommitException {
try {
sqlContainer.commit();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Is there another way to commit the transaction to the database ? Is this a bug ?
Thanks in adavance !