Skip to main content

Building entity objects connected through association and view objects linked through view links at runtime

In this post I'm sharing yet another sample on building dynamic business components. The sample attached in this post covers APIs for building entity objects connected through associations as well as entity object based  view objects linked through view links.  In fact, the credit for this sample goes to my colleague Sung Im (Architect - ADF BC) who is always helpful for me on all queries or discussions centered around dynamic business components. Many thanks Sung !

This sample will teach you the following:
  • APIs for building entity objects at run time
  • APIs for building association between  entity objects at run time
  • APIs for building view objects at run time
  • APIs for building view links at run time
Download 

You can download the sample workspace from here. [Runs with Oracle JDeveloper 11g R2  11.1.2.4.0 and Oracle XE].
To know the APIs take a look at DynamicBCExample.java. The method DynamicBCExample::doProcess(...) builds entity objects for  DEPARTMENTS and EMPLOYEES table, builds association between them, and then generates view objects with view links. To test, run test.jsf and click on the command button, watch the server console to see the run time logs (sorry, no 'nice' UI is added for this example application). On a related note, you need to have MDS configured for using this stuff  in your App. See the MDS entry in adf-config.xml file in the sample for details.

To learn more about dynamic ADF BC things refer  my previous posts as well:
Learn More ...

There are a lot more points like this. If  you are curious to learn the internals of the ADF Business Components and ADF Binding Layer,  the following book is for you - Oracle ADF Real World Developer’s Guide.
More details about this book can be found in this post- http://www.jobinesh.com/2012/10/oracle-adf-real-world-developers-guide.html

Comments

cpierres said…
Hi Jobinesh,

An other dynamic excellent sample.
However, it's not applicable for me because all your samples deals with Business components objects built from scratch. This sample would be so usefull if you can deal with existing BC (add a field for example).

I posted a technical request on METALINK with a use case, about 15 days ago (based on your samples) :

SR 3-7210796351 : PDefEntityObject and PDefViewObject don't work for existing Business components

I'm waiting for an answer.

I tried many solutions but unfortunately all failed.

Thanks Jobinesh,
Christophe
Mirek said…
Hi Jobinesh,

Could you confirm whether this post is still valid for ADF 12.1.3?
(I see ALL Departments listed for every Employee in the console log)

thanks,
Miroslaw

Popular posts from this blog

Happy New Year 2018 !

We can't go back and change the beginning, but we always can start where we are and change the ending. Believe in yourself and you will be unstoppable!

Wishing you and your family a very happy new year 2018 !!!

How to set Bind Variable Values at runtime ?

In this post I'm sharing a couple of approaches for programmatically setting bind variables values at run time. This post is an attempt to explain 'When to use what ?'[ In case if you are familiar with 'Bind Variables' in ADF BC, please refer Section 5.10, Working with Bind Variables in Fusion Developer's Guide ]

1. Set the Bind Variable value using RowSet::setNamedWhereClauseParam(...)

You can use use the setNamedWhereClauseParam(...) method on the ViewObject interface (which extends oracle.jbo.RowSet) to set the value for bind variables. Please note this sets the value on default RowSet. In other words, this doesn't have any effect on the secondary RowSets that you/system generates.
ViewObject vo = am.findViewObject("EmployeesView1"); vo.setNamedWhereClauseParam("bindVarDeptId", new Number(10)); vo.executeQuery();
2. Set the Bind Variable value using ViewObject's VariableValueManager::setVariableValue(...)

VariableValueManager Ma…