sakurashinken
sakurashinken

Reputation: 4080

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?

Upvotes: 0

Views: 579

Answers (2)

user207421
user207421

Reputation: 310884

You can't do that in SQL, let alone CachedRowSet, without executing DDL, and CachedRowSet doesn't support that. The part about a repeating value is an elementary violation of 3NF. You probably don't want to do any of this.

Upvotes: 0

eckes
eckes

Reputation: 10423

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.

Upvotes: 2

Related Questions