Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Populating Java JTable with Resultset from Oracle
I am not quite sure I understand your question.
If you are populating the JTable, you have the result set, and therefore the metadata.
If you have a table like this:
MyKey varchar(whatever)
MyInteger Number
MyBoolean Number(1)
??
Then I would do 1 of two things:
1) Change the "Boolean" to char(1), constrainted to Y/N or 1/0 -- that
will allow you to differentiate between integer and "boolean"
2) Name the column based on the "domain". For example, I have columns
"Smoker_YN" and "Complete_YN", both happen to be char(1) "booleans".
The key is you will have to implement your Oracle "Booleans" consistently so that your JTable population routine will have the information it needs to specify the correct renderer.
HTH Paul Neaves wrote:
> I'm writing a UI that sends dynamic queries to an Oracle database and
> populates a JTable with the resultset.
>
> The cell renderer for each cell is based on the data type of the
> column (from the metadata).
>
> The problem is that Oracle does not support boolean fields. And
> because the application doesn't know what the data types will be for
> each column until it is handed a resultset, it can't distinguish
> between an integer that represents a quantity and an integer ( 0 or 1
> ) that represents a boolean flag.
>
> Any ideas?
>
> Paul
Received on Wed Mar 20 2002 - 14:19:02 CST
![]() |
![]() |