Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

ADF Join View Object

user11922045Oct 19 2010 — edited Nov 3 2010
we have a Join View Object joining Customer and Order tables. The Output in ADF table is like this
CustomerName------------OrderID

John------------------------------------1
John------------------------------------2
John------------------------------------3
Tom------------------------------------80
Tom------------------------------------81
Tom------------------------------------82

We need to show the out but as

CustomerName------------OrdersPlaced
John------------------------------------1,2,3
Tom------------------------------------81,82,83

Please suggest how we can acheive this

Thanks

Edited by: user11922045 on Oct 19, 2010 2:53 PM

Comments

Shay Shmeltzer-Oracle
Are you asking how to get the UI to look like this, or how to get a query to look like this?
For UI you can probably base a pivot table on your current view with the customer on the left axis and the orders in the center?

If you are asking about how to achieve this in SQL one option would be to write a PL/SQL function that accepts the customerID and returns a list of orders for that id.
Then use that function in the SQL for your VO.
user11922045
Shay..

Basically i wish to hold the detail table records as an ArrayList of ValueObjects in the main Object.
In the scenario with Order and OrderDetail tables.. An OrderID (or OrderVO) should hold its corresponding OrderDetails in its own Value Object. Please suggest how to acheive this in ADF BC..
Class Definition of Order should look sth like this in java..
public Class Order{
String orderID;
String desc,
ArrayList orderDetails;
}

Thanks in Advance.
Shay Shmeltzer-Oracle
Well in that case all you need is to define a view link between the two VOs.
Then if you generate the Java file for the orders VO you'll see an accessor to get the order details.
user11922045
Yes, I did that, But some how the data in the link object (Order details) get populated only when the Order is selected on UI. Can we make sure the Order details get populated as soon as the Order data is fetched.. I mean if there are are 10 Orders fetched, we need Order details for all 10 Orders right away when the screen is displayed.

Please suggest.

Thank you.
John Stegeman
If you are using Oracle DB release 11g or later, you could use the [url http://www.oracle-developer.net/display.php?id=515]LISTAGG function to do this in a single query.

John
user11922045
Wow thats a great feature.. But it seems this limits to show just one column with a desired seperator .

Please suggest how we can populate an ArrayList of objects inside a ValueObject.

The View Link concept helps to populate the detail object based on an event on the Master Object(event being selection). I wish to populate the detail without any event..rightaway for every Master Object.
user11922045
Shay/John,

Please suggest if this is not possible with the current feature set.

Thanks
Please use the suggestion provided by Shay.
1) Create a transient attribute named OrdersForCustomer and expose these attributes in the VOImpl files.
2) In the getter method for the transient attribute, Iterate through the view link to find all the orders for the current customer and build a comma separated list and return it.

Thanks,
Navaneeth
Can you clarify why would you want to populate all the details for all the masters?
As you indicated the default behavior is to only bring in the detail data when you are actually looking at a specific master.
This seems to be more efficient way in terms of data transfer to the middleware and client.
user11922045
Our requirement is similar to a Order - OrderDetail example, (where the number of details many times wont exceed 3)
The Order table has just the Order number and some name... and Order detail has order item, price and date detail item requested ..
So we just need to show the list of Order and for each order( the details..item no, item, price, date time req)..

As you can see we can fetch it in one single query..

I can't ask the user to click on the Order number/name to see the Order details in adifferent table every time.

Typically when i was using java.. i used to populate the details into the Order VO as an ArrayList of Order Items. w could delete just one detail/ as well as a complete Order all together.

Please suggest.
I see two options:
1 - use a tree or a treetable to show your order and orderDetails - you'll do this with the viewLink:
http://jdevadf.oracle.com/adf-richclient-demo/components/treeTable.jspx
Each order will be a root node and the details will be below it.

2 - use either a join query or a calculated field in a VO and present data in a regular table.
Note that you can't have a table and in it for each row a collection - we currently don't support nested tables like that in the af:table component.
You might be able to do that with the af:foreach and af:iterator components though.
1 - 11
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 1 2010
Added on Oct 19 2010
11 comments
1,187 views