Issues With Container API, TableQuery and SqlContainer

Here is my situation:

I added a filter to a TableQuery. It is simply WHERE id=…
When I add the table query to a SqlContainer, the container replaces the delegate’s filter with its own filter. Because I have no container filter set, it clears the filter and retrieves all rows. It might make sense to copy the TableQuery filters into the SqlContainer, but there is no API to getFilters from a TableQuery…

So I put the filter into the container instead, and it worked, but that opened another
After creating an item through the addItem() method and retrieving the itemId, I can’t get the item from the container because it is filtered out. I have several workarounds for this situation.

  1. Cast Container to SqlContainer and call ((SQLContainer) container).getItemUnfiltered(iid)
  2. Make getItemUnfiltered API
  3. Allow return of Temporary Row Items from getItem(), even if they are filtered.
  4. Add a callback to the ContainerAPI for addItem, with an event exposing the itemId and item, allowing the client to initialize fields.
  5. After getting the itemID, save all filters, clear all filters, get the item, and restore the filters.

#1 and #5 are bad design.
#3 would change the current behavior but is the most intuitive
#4 Is messy, but could also function as a ctor to initialize new items before they are returned from the addItem call, allowing them to conform to the filter.
#2 would not interfere with any existing API