This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 113693 - Adding a query criteria changes Table binding
Summary: Adding a query criteria changes Table binding
Status: VERIFIED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: PC All
: P2 blocker (vote)
Assignee: Matthew Bohm
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-24 07:26 UTC by John Baker
Modified: 2007-09-03 15:36 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
diff of proposed fix (4.57 KB, text/plain)
2007-08-25 02:39 UTC, Matthew Bohm
Details
diff of revised proposed fix (7.69 KB, text/plain)
2007-08-28 05:02 UTC, Matthew Bohm
Details
diff of integrated fix (8.68 KB, text/plain)
2007-08-30 04:43 UTC, Matthew Bohm
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Baker 2007-08-24 07:26:39 UTC
After modifying the Table Layout to remove some display columns, I used the Query Editor to 
add a parameterized query a column that is not to be displayed.

After adding the query criteria and switching back to the Designer, the column that has the query criteria
reappeared as a display column in the Table

To reproduce:
1) Add a Table component
2) Drop a TRIP table onto the Table component
3) Using the Customizer, remove the tripid and personid columns from the display column
4) Edit the query on the tripRowSet and add a paramterized query for personid
5) Switch back to the Designer

personid is restored as a display column in the Table
Comment 1 Winston Prakash 2007-08-24 07:42:17 UTC
Since Matt added the Dataprovider listener, assigning this to him 
to take care of this bug.
Comment 2 Matthew Bohm 2007-08-25 02:39:50 UTC
Created attachment 47373 [details]
diff of proposed fix
Comment 3 Matthew Bohm 2007-08-25 02:50:42 UTC
I've attached a proposed fix (see attachment diff-0824-1830.txt), which is currently under review. In this diff, before
reconstructing the table columns, we try to determine whether the existing bindings will throw an ELException. We only
reconstruct the table columns if an ELException is detected. This may prove a good algorithm for determining whether to
reconstruct in response to a change in the dataprovider's wrapped data.
Comment 4 Matthew Bohm 2007-08-25 02:52:10 UTC
Adding wjprakash, sandipchitale to the CC list so they can see the proposed fix.
Comment 5 Matthew Bohm 2007-08-27 20:04:25 UTC
wjprakash wisely points out that we can remove columns that will throw an ELException rather than perform the more
drastic maneuver of reconstructing the table. I will revise the proposed fix.
Comment 6 Matthew Bohm 2007-08-28 05:02:56 UTC
Created attachment 47562 [details]
diff of revised proposed fix
Comment 7 Winston Prakash 2007-08-28 06:00:33 UTC
The diff looks OK to me.
Comment 8 Matthew Bohm 2007-08-30 04:43:37 UTC
Created attachment 47783 [details]
diff of integrated fix
Comment 9 Matthew Bohm 2007-08-30 05:06:35 UTC
Fixed.

Checking in webui/src/designtime/com/sun/webui/jsf/component/TableRowGroupDesign
Info.java;
/cvs/woodstock/webui/src/designtime/com/sun/webui/jsf/component/TableRowGroupDes
ignInfo.java,v  <--  TableRowGroupDesignInfo.java
new revision: 1.5; previous revision: 1.4
done

One note of interest. CachedRowSetXImpl.setCommand calls release, which leads to an invocation of
CachedRowSetDataProvider.fireProviderChanged. Following the call to release, setCommand calls
propertyChangeSupport.firePropertyChange, which leads to (1) the field keys updating based on the new command and (2) an
invocation of CachedRowSetDataProvider.fireProviderChanged. The net effect is that fireProviderChanged is called twice,
first with the old field keys in place and subsequently with the new ones in place. In my opinion, this is not a flaw in
CachedRowSetXImpl: release and firePropertyChange are firing two distinct events--it just so happens that they both
trigger calls to fireProviderChanged. Unfortunately, the distinction in *how* the provider has changed is lost; there is
no way to tell whether the number of rows have changed (due to the call to release) or whether the field keys have
changed (due to the call to firePropertyChange). This is just a limitation in the dataprovider API. The two consecutive
invocations of fireProviderChanged causes ProviderListener.providerChanged to be called twice, but the effect of the
repetition is benign: the first invocation never catches an ELException, precisely because the old field keys are still
in place. Thus the first invocation is effectively a no-op. The second invocation actually catches any ELException
resulting from the update to the field keys.
Comment 10 _ alexpetrov 2007-08-31 20:55:12 UTC
Unfortunately I was able to reproduce this bug on SunOS sparc:

Product Version: NetBeans IDE Dev (Build 200708300000) 
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b05 
System: SunOS version 5.10 running on sparc
Comment 11 _ alexpetrov 2007-08-31 21:04:18 UTC
And 1 more note:
a Table column, which was added to column set, but wasn't related to DB table, has been disappear 
after modification of CachedRowSet in Query Editor.
Comment 12 _ alexpetrov 2007-08-31 21:13:46 UTC
Oh, I'm very sorry, just now I see that this bug was fixed on 08/30/2007.
And the fix was not included into build 0708300000.
But there is no newer build now.

FIXED status is restored.
Comment 13 _ alexpetrov 2007-09-03 15:36:41 UTC
Verified on:

Product Version: NetBeans IDE Dev (Build 2007090300000) 
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b05 
System: SunOS version 5.10 running on sparc