javadatabasecachedrowset

How to add column to CachedRowSet in java 7?


I want to append a new column in the fashion of

public CachedRowSet addColumn(cachedRowSet Original,List<item> column, String columnName);

or

public CachedRowSet addColumn(cachedRowSet Original,int column,String columnName);

with the column value repeated if it is a primitive.

What is the best way to do this?


Solution

  • Hmm.. hard to answer without knowing the context. Who is providing that CachedRowSet? They might or might not offer a way to generate a new instance. Are you using CachedRowSetImpl from the RI?

    The RowSet is not really intended for that. Can you add it to the generating SQL? SELECT a,b,'additional' from .... Or you can use your CachedRowSet and generate JoinedRowSet with a FULL_JOIN with a single field result set.