VisualWebDatabaseCacheMetadata
Cache Metadata by Serializing the result set
Visual JSF Database design-time Performance hit in 6.0
In 6.0, an attempt to connect to a local or remote database occurs for the following 6.0 use cases
- Component binding tries to get a connection from CachedRowSet in the following scenarios
- Dragging and dropping a database table onto a Visual JSF page, component, or page bean in the Navigator
- Opening a page that has components bound to rowsets
- Refreshing a page that has components bound to rowsets
- (Re)Binding components to column keys of data provider
- Opening the Visual Query Editor from the rowset icon in the Navigator to edit a query
Proposal(s) to improve the design-time performance
- Retrieve the metadata the first time a database table is used and persist it in a file in the userdir
- Subsequent retrievals of metadata by way of the persisted file, not by opening a connection and re-retrieving
- Persist metadata is in serialized binary format
- Implement a mapping from the metadata file to a data provider
- Support some consistency mechanism if the schema changes after persisting the metadata
- Modify CachedRowSet to check for persisted metadata file.
- Use CachedRowSet only for retrieving metadata if persisted file doesn't exist
- If metadata file exists then use metadata from file in the data provider
Functional Spec
Metadata caching
- Retrieving/writing metadata from a serialized result set
Summarized
In the CachedRowSetDataProvider, an instance of result set meta is retrieved. A new helper class is needed to serialize the result set into XML. Then when the metadata is needed at design-time, the serialized file can be deserialized and made available.
Caching the metadata can be done by serializing the result set
- write metadata as binary file in the userdir under config/Databases/CachedMetaData
- File name is generated from the data source name plus the rowset command (limited to 20 characters)
- read metadata from binary file
- compare 2 metadata instance in memory
- replace metadata binary file if the rowset command property changes
- map metadata to dataprovider
Consistency
- If metadata file is inconsistent with the rowset from live connection then replace the metadata file
Use Cases
- Manual binding to a non-Table component
- Drag a database table and drop on the background of a Visual JSF page.
- if metadata XML or Java file persisted then use metadata from file, otherwise use CRS to retrieve the metadata and generate a persisted file
- Drag a Visual JSF component (excludes the Table component) onto the Visual JSF page
- Right-click on the component and choose Bind to Data. Metadata is retrieved locally from file.
- Drag a database table and drop on the background of a Visual JSF page.
- Automatic binding to a non-Table component
- Drag a Visual JSF component (excludes the Table component) onto the Visual JSF page
- Drag a database table and drop on top of a Visual JSF component to automatically bind to a column of the database metadata
- metadata XML or Java file persisted and dataprovider created
- Manual binding to Table component
- Drag a database table and drop on the background of a Visual JSF page.
- if metadata XML or Java file persisted then use metadata from file, otherwise use CRS to retrieve the metadata and generate a persisted file
- Drag a Visual JSF component (excludes the Table component) onto the Visual JSF page
- Right-click on the table component and choose Table Layout then select a dataprovider to bind.
- Metadata is available from local file
- Automatic binding to Table component
- Drag a Visual JSF Table component onto the Visual JSF page
- Drag a database table and drop on top of the Table component to automatically bind to a column of the database metadata
- metadata XML or Java file persisted and dataprovider created
- Open existing Visual JSF database project
- if metadata XML or Java file persisted then use metadata from file, otherwise use CRS to retrieve the metadata and generate a persisted file
- cachedRowSet indirectly uses metadata XML or Java to restore/maintain componenet bindings

