Consider the following code for my listgrid...
ComboBoxItem cbInsurer = new ComboBoxItem("insurer", "Insurer");
cbInsurer.setOptionDataSource(DataSource.get("insurer_DataSource"));
cbInsurer.setValueField("insurerId");
cbInsurer.setDisplayField("insurerName");
cbInsurer.setDefaultToFirstOption(false);
ListGridField hInsurer = new ListGridField("insurerId", "Insurer", 100);
hInsurer.setOptionDataSource(DataSource.get("insurer_DataSource"));
hInsurer.setDisplayField("insurerName");
hInsurer.setEditorType(cbInsurer);
The Record in the listgrid is "Client" and it has an insurerId foreign key to the Insurer table. It's edited using the combobox doing a dynamic lookup in the insurer_DataSource.
This works fine when I add a client. I save, the attached insurer is displayed etc. The problem comes when I change the insurer by selecting a different item in the combobox. I get the following error....
"Attempt was made to modify the parent of an object of type ...Client identified by the key Insurer(19001)/Client(1001). Parents are immutable (changed value is Insurer(16001))"
The Client datasource snippet that defines the foreign key is as follows:
<field name="insurerId" type="text" title="Insurer" canEdit="true"
foreignKey="insurer_DataSource.insurerId"/>
The Client bean field that identifies the relationship is as follows:
@Column (nullable = true)
@Extension (vendorName = "datanucleus", key = "gae.parent-pk", value = "true")
private String insurerId;
I'm using Google App Engine. Any help with this would be greatly appreciated.
-Greg
ComboBoxItem cbInsurer = new ComboBoxItem("insurer", "Insurer");
cbInsurer.setOptionDataSource(DataSource.get("insurer_DataSource"));
cbInsurer.setValueField("insurerId");
cbInsurer.setDisplayField("insurerName");
cbInsurer.setDefaultToFirstOption(false);
ListGridField hInsurer = new ListGridField("insurerId", "Insurer", 100);
hInsurer.setOptionDataSource(DataSource.get("insurer_DataSource"));
hInsurer.setDisplayField("insurerName");
hInsurer.setEditorType(cbInsurer);
The Record in the listgrid is "Client" and it has an insurerId foreign key to the Insurer table. It's edited using the combobox doing a dynamic lookup in the insurer_DataSource.
This works fine when I add a client. I save, the attached insurer is displayed etc. The problem comes when I change the insurer by selecting a different item in the combobox. I get the following error....
"Attempt was made to modify the parent of an object of type ...Client identified by the key Insurer(19001)/Client(1001). Parents are immutable (changed value is Insurer(16001))"
The Client datasource snippet that defines the foreign key is as follows:
<field name="insurerId" type="text" title="Insurer" canEdit="true"
foreignKey="insurer_DataSource.insurerId"/>
The Client bean field that identifies the relationship is as follows:
@Column (nullable = true)
@Extension (vendorName = "datanucleus", key = "gae.parent-pk", value = "true")
private String insurerId;
I'm using Google App Engine. Any help with this would be greatly appreciated.
-Greg
Comment