getItem not working when SQLContainer is set to autocommit = true

I have a table backed by a SQLContainer. This SQLContainer has autocommit activated. When I add items via final Object itemId = table.addItem(); and then try to get them by item = table.getItem(itemId); I only get null. I debugged the code and right after adding the item it is present in the database. But I have no clue why I get back a null value.

Hi,

the initial row ID is a temporary one, since it will be returned immediately, as the Javadoc for the addItem method states:

    /**
     * Note! If auto commit mode is enabled, this method will still return the
     * temporary row ID assigned for the item. Implement
     * QueryDelegate.RowIdChangeListener to receive the actual Row ID value
     * after the addition has been committed.

But whenn I add the following:

container.addRowIdChangeListener(new RowIdChangeListener() {
			
			@Override
			public void rowIdChange(RowIdChangeEvent arg0) {
				System.out.println("fired");
				
			}
		});

the event isn’t fired when container.commit() is executed.

I haven’t actually tried that myself recently but from experience I know that at least at some point the events have been working. Looking at the code it seems to me that it should fire. Of course it might have been broken by some regression at some point.

If the event indeed does not fire, please create a bug ticket at the
Vaadin trac
.