How to represent a boolean attribute
Sorry, obviously this is a "very stupid user" question, but to say the truth, I didn't find the clue yet.
What is the best way to store a simple boolean in an entity object connected to an Oracle9i database?
Sounds easy, but is not.
Unfortunately Oracle has no "BIT" or "BOOLEAN" Datatype, so you have to use a different one. I thought "CHAR(1)" should be suitable as this doesn't waste to much of dataspace. Please correct me if you think this is wrong!
Doing this I can match this column of Type "CHAR(1)" to several java datatypes. JDeveloper defaults to "String" for CHAR(1). But what I really want, is to match this Column to a "Boolean" as I would like to set my attribute like this: Row.setIsConfidential(true). Unfortunately this is not possible, as there is no cast from Boolean to char.
Do I really have to handcode the translation code to translate a simple boolean to something like "T" or "F" which I can store in my Database? I think there must be a better way!
Any hints are appreciated
Frank