This page documents the changes to the standard CachedRowSet API and implementation that were made for Creator/VisualWeb's implementation of CachedRowSet. These changes are grouped into areas of functionality, rather than focusing on specific code details. The intent is to understand the impact of this functionality going away, and what work we may need to do to adapt and be able to work with the RI.
The RI constructor for CachedRowSet throws a SQLException. This causes InSync to generate code that will not compile because it does not expect a Java Bean to throw an exception. Sandip and Deva are working on this and are extending InSync to allow a DesignBean to provide an initialization string that can be used when InSync generates initialization code for the bean in the application.
A minor item, but important. The package name used to construct the CachedRowSet implementation class changes (com.sun.rowset.CachedRowSetImpl versus com.sun.sql.rowset.CachedRowSetXImpl. This needs to be taken into account during code generation.
This is not the prettiest piece of code, but it gets the job done, and gets around a real limitation for design time work. You definitely do not want to execute a large query involving sorts and millions of rows at design time just to get the metadata.
We can move this code into CachedRowSetDataProvider.getFieldKeys(), which is how our design time stuff gets the metadata anyway.
Lance has indicated he is not interested in adding support for metadata prior to execution of the rowset to the spec. So we'll have to do this workaround for the foreseeable future.
Our extension of CachedRowSet allows a user to install a property change listener. A key client of this is the data binding code. When a user through the property editor or Visual Query Editor updates the command, url, dataSourceName or username properties, this fires off a property change event. This in turn caused the metadata that was cached in the rowset and CachedRowSetDataProvider to be flushed out, and then the metadata was re-fetched and any bound components refreshed to reflect the new metadata.
It is very unlikely that users made use of the property change listener functionality.
Internally, we have to change how we detect changes to the rowset. There are two approaches I am investigating.
The preferable approach is to use the DesignInfo pattern to detect changes. In NetBeans 5.5, CachedRowSet does not have a DesignInfo class. But in M10, we have added this class. As long as our code correctly sets properties by going through bean.getProperty("foo").setValue("bar"), then we can detect property changes in the DesignInfo class, and use this as our new implementation of a property change listener. The one trick I have yet to figure out is how to wire up the CachedRowSetDataProvider as a PropertyChangeListener on the rowset.
A plan B for this is to implement a dynamic proxy that wraps the rowset and intercepts any method calls. I'd like to avoid this approach if possible, but it is a viable alternative.
When you get the metadata for a join from a driver, it will always say all columns are read-only. However, our implementation allows a join to be writeable.
The RI does not allow rowsets based on a join to be writeable. In general, CachedRowSet was intended to work with a single table. Note for example, that it has a "tableName" property.
We will not support updatable rowsets for joins in NB 6 for new projects. We will allow users to continue to use our forked rowset in their old projects, but they will be warned that this feature is going into EOL.
For more details around this decision, see UpdatableCachedRowsetIssues
There are a few fixes in the Creator cached rowset code to handle issues with JDBC driver metadata. These fixes will not be in the standard RI. Hopefully they will be integrated into the latest RI and made available in Java SE 6 Update 3, which is expected to ship this fall.
We could potentially apply some of these fixes in our code (e.g. in the CachedRowSetDataProvider), but it seems more reasonable to just tell customers to upgrade to the new JDK if they want these fixes.
initMetadata()