18 August, 2011

SelectOneChoice Value


We will explain how to get the value of SelectOneChoice rather than index.
as figured in below picture

Assume we have a Model-Driven List for DepartmentId  attribute with the display value of DepartmentName and selectOneChoice bound to DepartmentId attribute in jspx page


Using Expression Language
the code of SelectOneChoice in page as below

<af:selectOneChoice value="#{bindings.DepartmentId.inputValue}"
                                                label="Select Department"
                                                required="#{bindings.DepartmentId.hints.mandatory}"
                                                shortDesc="#{bindings.DepartmentId.hints.tooltip}" id="soc1"
                                                binding="#{backingBeanScope.backing_SelectOneChoice.soc1}"
                                                autoSubmit="true">
                                <f:selectItems value="#{bindings.DepartmentId.items}" id="si1"
                                               binding="#{backingBeanScope.backing_SelectOneChoice.si1}"/>
                            </af:selectOneChoice>


12 August, 2011

ADF View Object

View object may have several instances at application module.
So I will explain confusion about that instances in this post.
Let's take example to illustrate confusion by example.
I will create view object Departments and create instance for it named DepartmentInstance

11 August, 2011

ADF Business Component Base Classes


Inroduction
ADF business component is ADF framework that we can use in Model view. It manages connection with database.
It is ready developed and you can customize it to get your customized framework.
It is contains several main classes that are essential for Model components that are illustrated in below picture.
For opening the below window Open Jdeveloper>Tools>Preference


As we noticed there are classes dedicated to Entity Object, View Object, Application Module.
I will clarify every one of them at next section.

06 August, 2011

Skip Validation in ADF


We can add validation at View , Model and business Services as wee need.
Sometimes we need to skip that validation and continue in executing the requested action.
Some developers in set immediate property to TRUE for UIcomponent but there is drawback of that property that it allows processing of UIcomponent to move to Apply Request Values phase of the life cycle.

We have another solution for skipping validation without moving up to  Apply Request Values phase of the life cycle as illustrated below.

04 August, 2011

Average on Dates Columns

SA,
As we know that is is impossible to calculate average on non numeric column.

SQL> select avg(hire_date) from scott.emp;

It will raise error
ORA-00932: inconsistent datatypes: expected NUMBER got DATE 

There is workaround to calculate avg on date columns.
Workaround is to convert date to julian date and then calculate average.


So the following is solution to make average on date column
SELECT TO_DATE(TRUNC(AVG( TO_CHAR(hire_date,'J'))),'J') FROM EMP;

Thanks

01 August, 2011

Get sequence next value in ADF


I will present how to use ADF BC to get next value of sequence.

1- Creating Method 

We can create generic method that I will pass to it sequence name and it will return next value.


As we noticed in previous code that I use SequenceImpl to get sequence value.