ComboBox don't show value on edit

I’m having such problem ->>> I have a form with combobox that adds and edits data in database. When I’m adding item it’s works ok. but when I’m getting current row(item) from databse and want’s to edit - my combobox don’t shows the value, please tell me how can I solve this problem ?

I’m using SQLContainer for binding. And here is source code of FieldFactory for my combobox :

 else if (pid.equals("birth_place")) {
					ComboBox field = new ComboBox("Birth place:",
					field.setRequiredError("Choose birth place");
					return field;

Please give me a solution for this problem.

Hi Manvel,

SQLContainer cannot follow relations between tables by itself, you have to implement that yourself. There are a couple of strategies:

  1. Use FreeformQuery and JOIN the tables together. In order for SQLContainer to be able to write the data, you then need to implement a FreeformStatementDelegate for the FreeformQuery. The delegate will handle things such as write support, lazy loading, etc. See the source code to the SQLContainer demos for an example of FreeformStatementDelegate.

  2. Don’t use Form for editing, but build the layout and fields yourself and bind birth_place to its own SQLContainer (in addition to the SQLContainer you already have). Bind the fields to the respective item properties and when the user clicks ‘save’, commit both SQLContainers. Some help with references between SQLContainers can be found from the addReference(), removeReference(), setReferencedItem(), getReferencedItemId() and getReferencedItem() methods in SQLContainer.