Help With Nested Data Binding.

I have a bean with the following attributes in a User class:

Role role;
private Set<Permission> assignedPermissions

I’m buiding the role dropdown like

BeanContainer<String, Role> beans = new BeanContainer<String, Role>(Role.class); beans.setBeanIdProperty("id"); List<Role> allRoles = rs.getAllRoles(); beans.addAll(allRoles); ComboBox cb = new ComboBox("Role", beans); cb.setItemCaptionPropertyId("label"); form.bind(cb, "role.id"); editorLayout.addComponent(cb); And it’s working great. When the form gets a change in setItemDataSource(), everything correctly maps to the change in Role objects. I’d like the same thing to happen to the set of Permissions in a TwinColSelect. So I thought something like this would work:

BeanContainer<String, Permission> pbeans = new BeanContainer<String, Permission>(Permission.class); pbeans.setBeanIdProperty("id"); List<Permission> allPermissions = ps.getAllPermissions(); pbeans.addAll(allPermissions); TwinColSelect tcs = new TwinColSelect("Permissions", pbeans); tcs.setItemCaptionPropertyId("name"); form.bind(tcs, "assignedPermissions.id"); editorLayout.addComponent(tcs); but I always get this error : “java.lang.NoSuchMethodException: java.util.Set.areId()”. It seems to be trying to find getId from the Permission Set rather from a Permission object. I think there is something fundamental I’m missing from what I’m doing when it comes to dealing with beans that have Sets or Lists of other beans (i.e. one to many or many to many).

I’ve been experimenting with
these examples
, using the calls addNestedContainerProperty() or addNestedContainerBean() but I’m not seeing how it relates to binding.

Any help or pointers are appreciated.

and just to be clear, i’m building the BeanContainer like this:

BeanContainer<String, User> beans = new BeanContainer<String, User>(User.class); beans.setBeanIdProperty("id"); List<User> allUsers = us.getAllUsers(); beans.addAll(allUsers); So I guessed the nesting happens here…perhaps with something like:

beans.addNestedContainerBean("assignedPermissions"); But it doesn’t seem to work. In fact, I can’t find an example of the proper use for addNestedContainerBean.