How to prefetch with filtering....

Posts   
 
    
Posts: 24
Joined: 19-Oct-2006
# Posted on: 10-Jan-2007 20:13:03   

Here is an example table structure:

Account

AccountID Name

Score

ScoreID AccountID StartDate EndDate Score

So, I want to do the following: I want to load the Account entity, and prefetch the Score entity whose EndDate is the greatest out of all associated Score entities. So, given this sample data for the Score table:

1 1 1/1/2000 1/5/2000 29 2 1 1/1/2001 1/3/2001 12 3 1 2/1/2001 2/7/2001 32

I only want the instance of Account to be fetched with the associated Score entity being the one whose ScoreID is 3, in this example, based on the fact that the value for that record's EndDate is 2/7/2001, which is greater than the other EndDate values....

Does this make sense? Is this possible? I know how to prefetch the associated Score records, I just don't understand how to apply filters to what is prefetched....

Thanks!

Posts: 24
Joined: 19-Oct-2006
# Posted on: 10-Jan-2007 22:23:57   

Nevermind, I got it figured out!

Thanks anyway....