[ADF EMG] [ADF-EMG] Dynamic rendering of Columns

711 views
Skip to first unread message

balasubramanian K

unread,
May 13, 2010, 6:24:49 AM5/13/10
to adf-met...@googlegroups.com
Hi All,
I have the following doubts:

1 ) We have a table with around 30 columns. At any point of time, the number of columns displayed on the page depends on the output of a query. And for the columns displayed on the page, we need to set the label dynamically from the result of another query. Is there any standard way of doing this?

2) We have an application with a single page. There are around 50 tables. All the 50 tables have the same columns. The reason for these many tables is there would lots of batch processing and simultaneous imports. To avoid any concurrent issues, each import process will load data into only one of the tables. Also, the data in the table is pretty huge. At any point of time, data displayed on the page comes only from ONE table. how do we achieve this using ADF? For now, what we do is, we create a View which is based on all the tables in the database. Based on the view, we display data on the page. Is there any other better approach for the same?


Thanks in advance


~Bala



--
You received this message because you are subscribed to the ADF Enterprise Methodology Group (http://groups.google.com/group/adf-methodology). To unsubscribe send email to adf-methodolo...@googlegroups.com

Andrejus Baranovskis

unread,
May 13, 2010, 8:51:27 AM5/13/10
to adf-met...@googlegroups.com
Hi,
 
Probably you can use ADF Dynamic Table. It allows to generate columns on runtime directly.
 
Andrejus

--
Oracle ACE Director

My Blog - http://andrejusb.blogspot.com/
My JDev/ADF Samples list - http://andrejusb-samples.blogspot.com/

Arun

unread,
May 13, 2010, 8:54:15 AM5/13/10
to adf-met...@googlegroups.com
.. in conjunction with Declarative VOs.

Ex : http://blogs.oracle.com/smuenchadf/examples/#141

-Arun

Simon Haslam

unread,
May 13, 2010, 10:34:30 AM5/13/10
to ADF Enterprise Methodology Group
Bala

Just stepping back to look at the overall architecture for a moment...

Splitting a large table (say, 100m rows or whatever) into different
segments to allow a higher level of concurrency is a common
requirement, especially on systems with a significant number of
processors and I/O bandwidth. To do this you'd almost always use a
partitioned table/indexes (note: Partitioning is a DB Enterprise
Edition option that you need to buy). Then the ADF application would
only have to look at one "normal" table rather than 50 different ones,
and it also gives the DBA plenty of flexibility for data management.

I realise it may be to late in your development to consider a
significant change like this, but if you do have the opportunity to
move to a partitioned table I would expect it would provide a
significant payback in reduced complexity over the lifetime of the
application.

If you are stuck with the 50 tables, and don't need to update the data
in them through the ADF app, you could consider an Oracle7 style
partition view (uses UNION ALL) which may be what you've tried. You
should get partition elimination in some circumstances, but it's
nothing like as useful as a partitioned table.

HTH


:Simon

Jean-Marc Desvaux

unread,
May 13, 2010, 9:58:54 AM5/13/10
to ADF Enterprise Methodology Group
I like this entry: One complex request and two small replies.

Can't avoid talking to myself saying : "ADF is powerful".
There is even a chance that my wife will wake me up in the middle of
the night and ask : Who is ADF ??

That could be a good ADF advert. Isn't it?
:-)

balasubramanian K

unread,
May 14, 2010, 2:55:20 AM5/14/10
to adf-met...@googlegroups.com
Hi,
Thanks for the replies. The two approaches mentioned by Andrejus and Arun doesn't work for me.

In case of dynamic tables, i create a VO with select * from table as the VO query. Now at run time when i change the query to something like this: select a,b from table. I get an error "Failed to load data at index 2".

Wrt declarative VO's that sql option is available only on VO's based on EO's. In our case, we just need to display data. There isn't any EO object for the same. We are looking at DB partitioning options as well.

I have another doubt as well:
Since we have to set label for the table column based on a query, some level of googling, i found this approach suggested by Steve Munech in one of his blogs.

            attrDefImpl = (AttributeDefImpl) getViewObject().findAttributeDef("AttributeName");
            if (attrDefImpl != null) {
                        attrDefImpl.setProperty("LABEL","LabelName");
          }

Is it a good practice to set column labels at model level or is there any disadvantage in following this approach.


Thanks,
bala

Andrejus Baranovskis

unread,
May 14, 2010, 6:47:14 AM5/14/10
to adf-met...@googlegroups.com
Dynamic table will not work for you by default, you need to keep track of what columns are included into SQL and generate then appropriate columns on JSF part (same principle as ADF Dynamic table). You need to generate JSF columns on runtime.
 
Andrejus

--
Oracle ACE Director

My Blog - http://andrejusb.blogspot.com/
My JDev/ADF Samples list - http://andrejusb-samples.blogspot.com/

agawish

unread,
May 14, 2010, 6:45:35 AM5/14/10
to ADF Enterprise Methodology Group
I once had this problem.

But the labels was actually coming from another query, a search query
above it and the data itself is a count query for some little BI
challenge.

I used forEach inside a table to generate the columns, and created a
couple of classes to extract the information of every row/column.

The problem in this approach is that you have to refresh the whole
page in order for all the columns to re-appear, but no error is given
though!

Soyer, Muhammed A.

unread,
May 14, 2010, 8:15:35 AM5/14/10
to adf-met...@googlegroups.com
This can be achieved by creating the VO at runtime in the AM.
I once achieved something like what you want. I wanted to put a input box and let the user enter whatever query he wants and executes. The results come in an AF:Table

In the AM

public void createVoWithQuery( String pQuery )
{

ViewObjectImpl vo = null;
if( findViewObject( "DemoVo" ) != null )
findViewObject( "DemoVo" ).remove();

vo = ( ViewObjectImpl )createViewObjectFromQueryStmt( "DemoVo", pQuery );

vo.executeQuery();
}


@Override
protected void prepareSession( Session session )
{
super.prepareSession( session );
if( findViewObject( "DemoVo" ) == null )
createViewObjectFromQueryStmt( "DemoVo", "Select 1 from dual" );
}


In the page definition

<executables>
<variableIterator id="variables">
<variable Type="java.lang.String" Name="createVoWithQuery_pQuery" IsQueriable="false"/>
</variableIterator>

<iterator Binds="DemoVo" RangeSize="25" DataControl="AppModuleDataControl"
id="ViewObj1Iterator" Refresh="deferred"/>

</executables>

<bindings>
<tree IterBinding="ViewObj1Iterator" id="ViewObj1">
<nodeDefinition Name="Dummy">

</nodeDefinition>
</tree>
.
.
.

ugb

unread,
May 14, 2010, 8:15:46 AM5/14/10
to ADF Enterprise Methodology Group

Hi,
maybe it help when you think about the following design for your
Problem:

a) DataViewVO
This VO deliver the data from N tables with Union, Table based
functionbase etc. with X Columns (A1-Z1).

b) DataViewConfigVO
This VO deliver all needed properties for each Column of DataViewVO.
Label, DisplayColumn, ...
This VO deliver only one row to the UI.

c) BusinessService: searchDataView(paraA,paraB)
This Service Setup the both VOs for your UI.

d) DataViewDialog
Use DataViewConfigVO to Display the needed columns and Labes.
Use searchDataView to quer and setup your ui properties.

This Solution give you the best fexibility for the different parts
like query the data, add new properties for the ui or order of
columns.

Uli

Use DataViewVO to Display
Reply all
Reply to author
Forward
0 new messages