Hi,
I have seen many people asked this question at OTN forums so i decided to blog it.
In Oracle ADF af:selectBooleanCheckbox and af:selectBooleanRadio component has Boolean datatype which is not actually SQL supported data type (In Oracle we have Boolean in PL/SQL) and most of us stores boolean column values as Y/N or 1/0 in our tables.
Solution is pretty simple you have to add transient attribute in your ViewObject and set the values to your actual attribute based the values in transient attribute
Follow these steps:
1) Add a Transient Boolean attribute in your VO
2) Generate a Java class ViewRowImpl with Accessors of your VO
3) Set your attribute's values in Transient getter and setter method
Heres the example:
Create a table called checkboxer
- Create a ADF application and add checkboxer's EOs VO and AM
- Add a Transient attribute called StatusBoolean in VO
- Generate ViewRowImpl class replace the existing code with as shown in the slide
- Thats all Run the Business component browser and check the values
- Drop a collection as ADF table and right click the StatusBoolean column and choose Convert to.. and select Checkbox boolean.
Download the workspace
I have seen many people asked this question at OTN forums so i decided to blog it.
In Oracle ADF af:selectBooleanCheckbox and af:selectBooleanRadio component has Boolean datatype which is not actually SQL supported data type (In Oracle we have Boolean in PL/SQL) and most of us stores boolean column values as Y/N or 1/0 in our tables.
Solution is pretty simple you have to add transient attribute in your ViewObject and set the values to your actual attribute based the values in transient attribute
Follow these steps:
1) Add a Transient Boolean attribute in your VO
2) Generate a Java class ViewRowImpl with Accessors of your VO
3) Set your attribute's values in Transient getter and setter method
Heres the example:
Create a table called checkboxer
create table checkboxer (date_val timestamp, check_status varchar2(1 char));
- Create a ADF application and add checkboxer's EOs VO and AM
- Add a Transient attribute called StatusBoolean in VO
- Generate ViewRowImpl class replace the existing code with as shown in the slide
- Thats all Run the Business component browser and check the values
- Drop a collection as ADF table and right click the StatusBoolean column and choose Convert to.. and select Checkbox boolean.
Download the workspace
thanks
ReplyDeleteYes I am also looking for a way to do the same and searched so many blogs to find an answer. Finally I found a great solution to implement this thing. Thanks for sharing the way to add a Boolean checkbox. I will refer this post to all my friends too.
ReplyDeletesap testing
Blog is copied from http://www.baigzeeshan.com/2010/05/adding-boolean-checkbox-to-table.html. Stop this Saravanan if you can't write your own blogs.
ReplyDeleteBolg is copied..... Shame on you...!
ReplyDelete