Complex prefetching

Posts   
 
    
PaulH
User
Posts: 10
Joined: 04-Nov-2005
# Posted on: 21-Nov-2005 17:55:38   

I have a slightly more complex prefetch to the one that you helped with a few weeks ago:

Person can have PositionOccupancies, a PositionOccupancy is for a Position, a Position can belong to a department and be related to a JobType.

Have tried the following without success as the PositionOccupancy is being prefetched twice:

Dim obj as IPrefetchElement obj = PERSONEntity.prefetchpathPositionOccupancy obj.subpath.add(POSITIONOCCUPANCYEntity.PrefetchPathPOSITION).subpath.Add(POSITIONEntity.PrefetchPathJOBTYPE) obj.subpath.add(POSITIONOCCUPANCYEntity.PrefetchPathPOSITION).subpath.Add(POSITIONEntity.PrefetchPathDEPARTMENT)

I can't seem to find a variant which works correctly,

Many thanks, Paul.

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 22-Nov-2005 02:16:11   

This happens because the POSITIONOCCUPANCYEntity.PrefetchPathPOSITION is defined twice. What you want to do is assign another subpath to the first instance of POSITIONOCCUPANCYEntity.PrefetchPathPOSITION. Here is a way to do this,

Dim obj as IPrefetchElement obj = PERSONEntity.prefetchpathPositionOccupancy obj.subpath.add(POSITIONOCCUPANCYEntity.PrefetchPathPOSITION).subpath.Add(POSITIONEntity.PrefetchPathJOBTYPE) obj(0).subpath.Add(POSITIONEntity.PrefetchPathDEPARTMENT)