Testing weather a relationship is fetched

Posts   
 
    
Posts: 34
Joined: 08-Nov-2007
# Posted on: 10-Nov-2007 15:37:04   

LLBLGEN 2.5, Adapter 2 classes.

Customer has Order via Customer.Orders, how can I test on the customer entity weather this has fetched or not?

stefcl
User
Posts: 210
Joined: 23-Jun-2007
# Posted on: 10-Nov-2007 20:27:22   

It's not possible... This explains why : http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=2013

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 11-Nov-2007 11:24:04   

There has been some more debates about this. The main issue is that the data which says 'this collection has been fetched' is only information in the context of the code which did the fetching. Because if you then use the object in some other fetch code, the data has no meaning afterwards.

So, you do know if there's been fetching performed, as you executed the code. If the collection then is empty: you do know what it means: there weren't any rows.

It's not as simple as it looks: A fetch could have been performed with a complex filter which did resolve into 0 rows. You therefore can't conclude afterwards in ANOTHER routine 'oh, this collection has been fetched already', because the filter you'll be using THERE might be different and might be result in 1 or more rows.

Frans Bouma | Lead developer LLBLGen Pro