Hi Stefan,

Stefan Klein wrote:

I wanted to use a FormTable with an CayenneForm, using 
getDataObject().get/toManyRelationShip/() to set the rowlist of the FormTable.
getDataObject() tries to construct the dataobject by using the oidField which 
holds the primary key. Well, the oidField only holds the primary key after it 
is proccessed. So to get the column fields of the FormTable get processed it 
needs to have it's rows filled befor onProcess, but i only get the row list 
after onProcess (if i am using the suplied getter).

Should i read the value of FO_ID on my own, construct the dataobject and use 
setDataObject to set it or is there a cleaner/better way to solve this?


You are right, you need to ensure the oidField contains its value *before* onProcess in order to populate the FormTable.

You could encapsulate this "early binding" with a custom CayenneForm so that the oidField and classField values are available before onProcess. For example:

  public class MyCayenneForm extends CayenneForm {

    public MyCayenneForm(String name) {
      super(name);

      // Bind the oidField and classField to request parameters
      oidField.bindRequestValue();
      classField.bindRequestValue();
    }
  }

Hope this helps.

kind regards

bob

Reply via email to