SQLContainer problem inserting value

I have a SQLContainer cont attached to a table with columns id and name
I have a form with two textfields id and name and a button insert, the button has a listener on click that insert the values in the container. I have this behavior:

If I insert a invalid value that violate foreign key relate to id, something like

id=“” name=“Joe”,
it throws error saying that id violate the a foreign key restriction

Thats OK, but if inmediatly after, try to insert a proper value
id=“1” name=“Joe”
it throws the same error, I check and the values of the textfields are OK.

The below is the code:

button.addClickListener(new Button.ClickListener() {
			public void buttonClick(ClickEvent event) {
                                String idS = id.getValue();
				String nameS= name.getValue();
                                //some verifications code 
                               c.getContainerProperty(itemId, "id").setValue(id);
				c.getContainerProperty(itemId, "name").setValue(name);

                                   try {
                                  catch (SQLExceptione) {
					Notification.show("Error al insertar");
				} //some catch more heres