Question

The Vaadin book says:

Normally, the SQLContainer will handle refreshing automatically when required.

However, where is this defined? How often will the container refresh?

I have tried to test this but unable to resolve

Was it helpful?

Solution

You can simply check SQLContainer code.

The phrase

Normally, the SQLContainer will handle refreshing automatically when required.

means SQLContainer will refresh itself after some changes made to it's state. For example, after adding orderBy refresh() will be called:

   /**
     * Adds the given OrderBy to this container and refreshes the container
     * contents with the new sorting rules.
     * 
     * Note that orderBy.getColumn() must return a column name that exists in
     * this container.
     * 
     * @param orderBy
     *            OrderBy to be added to the container sorting rules
     */
    public void addOrderBy(OrderBy orderBy) {
        if (orderBy == null) {
            return;
        }
        if (!propertyIds.contains(orderBy.getColumn())) {
            throw new IllegalArgumentException(
                    "The column given for sorting does not exist in this container.");
        }
        sorters.add(orderBy);
        refresh();
    }

This is true for all other operations (please note refresh() call):

  public void rollback() throws UnsupportedOperationException, SQLException {
        debug(null, "Rolling back changes...");
        removedItems.clear();
        addedItems.clear();
        modifiedItems.clear();
        refresh();
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top