So we have a few tables with millions of records. I took the approach suggested in the API and QuickStart guide (and referenced here http://forums.smartclient.com/showthread.php?t=22676&highlight=limit+listgrid+records)
We have our own extended SqlDataSource which will check fetch() requests and throw an error if the resultSet is too large.
If this isn't the correct way to do that, please let me know.
Assuming that is the correct way, we now have an issue with anything that has an optionDataSource to the datasources that have this fetchLimit in place - they just don't load and timeout or they just crash if in devmode after a long wait (garbage collection error).
Is there an alternative to optionDataSource? And if so, will it work with the large data Multi-Search SelectItem example from showcase? We need that as well.
I've done the straight up foreign key and then modified the fetch to populate a client-side field but then it seems all of the other stuff has to be hand-coded (editorType, multi-search SelectItem, etc).
Suggestions?
We have our own extended SqlDataSource which will check fetch() requests and throw an error if the resultSet is too large.
Code:
@Override public DSResponse executeFetch(DSRequest req) throws Exception { String fetchLimitStr = getProperty("fetchLimit"); int fetchLimit = Integer.MAX_VALUE; long totalRows = 0; DSResponse response = super.executeFetch(req); totalRows = response.getTotalRows(); if (fetchLimitStr != null) { boolean bNoFormatError = true; try { fetchLimit = Integer.valueOf(fetchLimitStr); } catch (NumberFormatException e) { logger.error("DataSource " + this.getID() + " has invalid value for 'fetchLimit' field. Please use a valid integer value. Value used was " + fetchLimitStr + "."); bNoFormatError = false; } if (bNoFormatError) { totalRows = response.getTotalRows(); logger.debug("DataSource " + this.getID() + " has record fetch limit set to " + fetchLimitStr); if (totalRows > fetchLimit) { logger.warn("DataSource " + this.getID() + " fetch resulted in " + totalRows + " but fetch limit set to " + fetchLimitStr + ". DSResponse status set to failure."); response.setData("Query resulted in too many records being returned (" + totalRows + "). Please filter your query and try again."); response.setFailure(); response.setStartRow(0); response.setEndRow(0); response.setTotalRows(0); } } } return response; }
Assuming that is the correct way, we now have an issue with anything that has an optionDataSource to the datasources that have this fetchLimit in place - they just don't load and timeout or they just crash if in devmode after a long wait (garbage collection error).
Is there an alternative to optionDataSource? And if so, will it work with the large data Multi-Search SelectItem example from showcase? We need that as well.
I've done the straight up foreign key and then modified the fetch to populate a client-side field but then it seems all of the other stuff has to be hand-coded (editorType, multi-search SelectItem, etc).
Suggestions?
Comment