This is a migrated thread and some comments may be shown as answers.

Modeling a boolean value in an Oracle database

1 Answer 54 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chen
Top achievements
Rank 1
Chen asked on 07 Jun 2012, 03:38 PM
I have a boolean value want to save to Oracle database. Since Oracle does not support "bit" type, I have to use Number(0,1) and I can't map it to a boolean property in my mapping class. I used int type to map to database and convert it to boolean when I use it in my code.

Is there a way I can map the boolean property to the Oracle database table directly?

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Ralph Waldenmaier
Telerik team
answered on 08 Jun 2012, 07:21 AM
Hello Chen,

You can specify you property as boolean directly. There is no need for you to do some extra casts in your project. 
Please see the attached sample project, where I have an example for a forward mapped boolean, which is translated to the db type number. Also you can find a reverse project, where I used a number(1) db type that is mapped to a boolean in my domain class. Please adjust the connection string in the app.config to work with the projects.

I hope this information is useful for you.
Feel free to ask if you have any other question.

Kind regards,
Ralph
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
Tags
General Discussions
Asked by
Chen
Top achievements
Rank 1
Answers by
Ralph Waldenmaier
Telerik team
Share this question
or