lethologica wrote:
Here is our scenario:
Data
Customer -- 1:M -- Credit Cards
On the client side, we have a form (Customer Form) which opens a search form. The search form loads a list of customers. Once a customer is selected, the entity is passed back to the Customer Form. From there we display the credit cards on a grid.
Currently, when we load the data for the search screen we have a prefetch path which includes a path to the credit cards. It loads the data fine.
This solution has the possibilty to be very slow. We want to fetch just the credit cards for a customer.
Is there something built in that will do this for us? Or do we have to fetch the list manually based off of the PK of the customer?
Thanks
You'll need to fetch the list manually as there is no way to designate which of the Customers in the list you wish to load Credit Cards for - this would amount to some sort of conditional join.
As you don't really have a problem in Self-Servicing, I assume you're using Adapter. Probably the best solution for you is the Context object. You can find more information in the docs at "Using the generated code->Adapter->Using the context". But, basically, a context allows you to take an existing, fetched entity or graph, and fetch additional data "into" it.
So, in your case, remove the prefetch path for credit card, then, when the user chooses the customer, use the Context and fetch the credit card information INTO the selected customer. No refetches necessary and you get your complete object graph returned intact with the additional information.
Jeff...