have related entities been fetched.

Posts   
 
    
Posts: 56
Joined: 08-Jun-2010
# Posted on: 12-Jul-2010 19:02:30   

Hi

I'm using V3 adapter.

I'm writing a method which takes an entity as a parameter and walks over one of its 1:m relationships. Often there will be no related entities.

At the moment each time the method is called I refresh the relationship from the DB. Often this will be unnecessary as the entity may have fetched this relationship already.

is there a way of telling the difference between a relation collection which is empty because there is no related data in the DB and a relation collection which is empty because the data hasn't been fetched?

Thanks ~Brett

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 13-Jul-2010 05:02:49   
is there a way of telling the difference between a relation collection which is empty because there is no related data in the DB and a relation collection which is empty because the data hasn't been fetched?

In short, no. The adapter classes are considered disconnected from whatever persistence store, so if there is no data in the collection, either you didn't fetch it or it wasn't there. Which one it is, depends on your own code. If you request the data for some entity and some related collections, the data is thus fetched and apparently there was no data.

If you want the long version's debate: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=2013 The short version: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=4654

David Elizondo | LLBLGen Support Team