Intermediate tables, refetches and collections not in the prefetch

Posts   
 
    
ChrisK
User
Posts: 3
Joined: 13-Mar-2008
# Posted on: 13-Mar-2008 21:35:27   

Hello,

I have a situation where I'm updating an intermediate table after an update of the parent entity. All of my data is preset in the parent entities collections for the intermediate table. That intermediate table also depends on the primary key ID that'll return in the refetch after a save of the entity. I'd like to know if there is no prefetch set for the collections associated with the intermediate table and the entity, but I specify refetch in the adapter if my collections will be left alone. Will they be overwritten to empty collections or set to out of sync?

Thanks in advance, Chris

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 14-Mar-2008 08:53:44   

I'm sorry, I found it hard to follow your question. Would you please rephrase your question with a code snippet to describe what you want to do?

Thanks.

ChrisK
User
Posts: 3
Joined: 13-Mar-2008
# Posted on: 14-Mar-2008 15:44:03   

Ok,

Say I have EntityA which has a collection CollectionB.

CollectionB is populated with values.

I have Refetch specified in my call against the adapter when Saving EntityA. I don't specify a prefetch for CollectionB. So no entities should be fetched for CollectionB.

But, I have values in CollectionB.

After the save, what is the state of CollectionB? Do the values that were there before the save remain?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 14-Mar-2008 16:05:23   

If you don't refetch the graph, the collection will remain as it was before the save action. To the collection nothing seemed to happened around simple_smile

If you save the graph (recursively) and specify Refetch = true, then the collection would be saved and refetched too.

ChrisK
User
Posts: 3
Joined: 13-Mar-2008
# Posted on: 14-Mar-2008 16:08:34   

Thanks,

That's what I needed. simple_smile

Chris