Board index » jbuilder » JdbList with picklist: unsynchronized DataRow

JdbList with picklist: unsynchronized DataRow


2004-05-26 03:51:30 AM
jbuilder15
Hi,
I'm using JdbList to display data from a Oracle DB table (tableA).
The assigned Column uses a picklist, which maps the numeric IDs from the
tableA to text values from a another tableB.
My code looks something like this:
// Table A
DataSet dstableA = new DataSet();
Column columnA = new Column();
...
columnIdA.setDataSet(dstableA);
columnIdA.setColumnName("ID);
// Table B
DataSet dstableB = new DataSet();
Column columnIdB = new Column();
Column columnIdText = new Column();
...
columnIdB.setDataSet(dstableB);
columnIdB.setServerColumnName("ID_B);
columnIdText.setDataSet(dstableB);
columnIdtext.setColumnName("TEXT_B");
columnIdA.setPickList(new PickListDescriptor(dstableB,
new String[] {"ID_B"},
new String[] {"TEXT_B"},
new String[] {"ID_A"},
"TEXT_B",
false));
// Display:
JdbList jdbListA = new JdbList();
jdbListA.setDataSet(dstableA);
The jdbListA displays the expected text from tableB, but when changing
another column in tableA and levaing this input control following
Exception appears.
I think, problemn is, that the JdbListBox should NOT try to update the
assigned data set or even save changes.
Trying to set the columnA.setReadOnly(true) doesn't solve this.
error code com.borland.dx.dataset.DataSetException: BASE+31
com.borland.dx.dataset.DataSetException: (translated text:)
"INCOMPATIBLE_DATA_ROW: Attempted to use a DataRow with a DataSet that
are no longer synchronized. A DataRow must be created with the DataSet
it is used with. If the structure of a DataSet changes, a new DataRow
must be created for it."
at com.borland.dx.dataset.DataSetException.a(Unknown Source)
at com.borland.dx.dataset.DataSetException.j(Unknown Source)
at com.borland.dx.dataset.ReadRow.a(Unknown Source)
at com.borland.dx.dataset.StorageDataSet.a(Unknown Source)
at com.borland.dx.dataset.StorageDataSet.a(Unknown Source)
at com.borland.dx.dataset.DataSet.locate(Unknown Source)
at com.borland.dbswing.JdbList.updateSelectedListValue(JdbList.java:372)
at com.borland.dbswing.JdbList.dataChanged(JdbList.java:427)
....
Thanks for any help.
 
 

Re:JdbList with picklist: unsynchronized DataRow

OK, after a few days vacation, some things cleared up ;-)
The error message was rather exactly:
The picklist dataset (dstableB) was upated after instead before the main
dataset (dstableA).
steve_32168 wrote:
Quote
Hi,

I'm using JdbList to display data from a Oracle DB table (tableA).
The assigned Column uses a picklist, which maps the numeric IDs from the
tableA to text values from a another tableB.

My code looks something like this:

// Table A
DataSet dstableA = new DataSet();
Column columnA = new Column();
....
columnIdA.setDataSet(dstableA);
columnIdA.setColumnName("ID);

// Table B
DataSet dstableB = new DataSet();
Column columnIdB = new Column();
Column columnIdText = new Column();
....
columnIdB.setDataSet(dstableB);
columnIdB.setServerColumnName("ID_B);
columnIdText.setDataSet(dstableB);
columnIdtext.setColumnName("TEXT_B");

columnIdA.setPickList(new PickListDescriptor(dstableB,
new String[] {"ID_B"},
new String[] {"TEXT_B"},
new String[] {"ID_A"},
"TEXT_B",
false));
// Display:
JdbList jdbListA = new JdbList();
jdbListA.setDataSet(dstableA);


The jdbListA displays the expected text from tableB, but when changing
another column in tableA and levaing this input control following
Exception appears.

I think, problemn is, that the JdbListBox should NOT try to update the
assigned data set or even save changes.
Trying to set the columnA.setReadOnly(true) doesn't solve this.

error code com.borland.dx.dataset.DataSetException: BASE+31
com.borland.dx.dataset.DataSetException: (translated text:)
"INCOMPATIBLE_DATA_ROW: Attempted to use a DataRow with a DataSet that
are no longer synchronized. A DataRow must be created with the DataSet
it is used with. If the structure of a DataSet changes, a new DataRow
must be created for it."
at com.borland.dx.dataset.DataSetException.a(Unknown Source)
at com.borland.dx.dataset.DataSetException.j(Unknown Source)
at com.borland.dx.dataset.ReadRow.a(Unknown Source)
at com.borland.dx.dataset.StorageDataSet.a(Unknown Source)
at com.borland.dx.dataset.StorageDataSet.a(Unknown Source)
at com.borland.dx.dataset.DataSet.locate(Unknown Source)
at com.borland.dbswing.JdbList.updateSelectedListValue(JdbList.java:372)
at com.borland.dbswing.JdbList.dataChanged(JdbList.java:427)
.....

Thanks for any help.