Filter on a table with Foreign Key

Hi,

I have a table that contains users (named “user”). Each user has a code. Codes are registered in the table “Code”.
In my database, the code id is registered in the table “user” as “idCode”.

I want to filter users by the name of their code, like this :
http://demo.vaadin.com/book-examples/book/?restartApplication#component.textfield.textchangeevents.filtering
→ The name of the code (registered in the table “code” as “libelle”) is entered, and the list of users changes.

Everything works with containerUser.removeAllContainerFilters(); but I don’t want to remove all the container filters, only the filter on the code id.

So, I should write : containerUser.removeContainerFilters("code.idCode"); but it doesn’t work and I don’t know why. Have you got any idea ?


TextField filterField = new TextField("field3");

		filterField.setInputPrompt("No filter");
		filterField.setImmediate(true);
		filterField.addListener(new TextChangeListener() {

			public void textChange(TextChangeEvent event) {
		      
				HbnContainer<?> containerCode = dataLogic.getContainerCode();
				HbnContainer<?> containerUser = dataLogic.getContainerUser();

		        String filter = (String) event.getText();
		       
		        if (filter == null) {
		        	containerCode.removeContainerFilters("libelle");
			        containerUser.removeAllContainerFilters();
		            return;
		        }
		        
		        containerCode.removeContainerFilters("libelle");		     
		        containerUser.removeAllContainerFilters();
		        
		        containerCode.addContainerFilter("libelle", filter, true, false);

				ArrayList<?> ids =  (ArrayList<?>) containerCode.getItemIds();
				
				Criterion criterion = Restrictions.in("code.idCode", ids);		
				containerUser.addContainerFilter(criterion);
			}			
		});

Tell me if you have any questions. Thanks for your help !

Any idea ?