Loop through the collection that contains the child objects (or make a
reference to the parent object if you are going in the opposite
direction).  As you do that FDS will spot that it has a proxy object
and request the real object through a getItem() call to your child
destination.

On the client side you'll get an itemPendingError which you may have
to trap and handle.  If you are just showing your child list in a
datagrid then the itemPendingError is handled for you, in fact there
are quite a lot of cases where you don't have to worry about the lazy
loading, the framework will take care of it for you.  However it is
not comprehensively handled so it's worth understanding what you have
to do to cope with it.  

My advice is make your object access as close to the "top" of the
processing layers in your application as you can, that way you can
re-call your methods in response to an itemPendingError returning data
without adversely affecting your user experience.

--- In flexcoders@yahoogroups.com, "Rich Tretola" <[EMAIL PROTECTED]> wrote:
>
> Vic,
> 
> Can you share some of your AS/MXML code?  What are you using to
> trigger the call to get the lazy objects?
> 
> Rich
> 
> On 9/25/06, passive_thoughts <[EMAIL PROTECTED]> wrote:
> > Yeah, I think the dataservices stuff rocks.
> >
> > Here's an example.  I have a contact and address table.  A contact can
> > have multiple addresses.  Now I'm not a java guy (tho slowly turning
> > into one) so I built my tables in mysql adding the appropriate foreign
> > keys.  Then I ran the hibernate tools in eclipse to autogenerate my
> > java objects, the hibernate config file and the hibernate mapping
> > files.  Notice... no java coding :)
> >
> > Then I created 2 destinations:
> >
> > <destination id="com.abc.vo.Contact">
> >    <adapter ref="java-dao" />
> >    <properties>
> >        <use-transactions>true</use-transactions>
> >        <source>flex.data.assemblers.HibernateAssembler</source>
> >        <scope>application</scope>
> >        <metadata>
> >           <identity property="id"/>
> >           <one-to-many property="addresses"
> > destination="com.abc.vo.Address" lazy="true"/>
> >        </metadata>
> >        <server>
> >            <fill-configuration>
> >               <use-query-cache>false</use-query-cache>
> >               <allow-hql-queries>true</allow-hql-queries>
> >            </fill-configuration>
> >         </server>
> >         </properties>
> >     </destination>
> >
> >     <destination id="com.abc.vo.Address">
> >         <adapter ref="java-dao" />
> >         <properties>
> >             <use-transactions>true</use-transactions>
> >             <source>flex.data.assemblers.HibernateAssembler</source>
> >                 <scope>application</scope>
> >             <metadata>
> >                 <identity property="id"/>
> >                 <many-to-one property="contacts"
> > destination="com.abc.vo.Contact" lazy="true"/>
> >             </metadata>
> >             <server>
> >              <fill-configuration>
> >                 <use-query-cache>false</use-query-cache>
> >                 <allow-hql-queries>true</allow-hql-queries>
> >              </fill-configuration>
> >             </server>
> >         </properties>
> >     </destination>
> >
> > In my code I create a dataservice pointing to the contact destination,
> > and when I call fill, it loads the contacts, as well as *just* the id
> > field values of all address child records (hence the term lazy).  When
> > a user double clicks on the contact, flex will actually go and get the
> > full address records at that time.  Also, as a side note, I can do the
> > same thing in reverse... i can load an address and then get to the
> > contact... not really useful in this situation but might be in others.
> >
> > Hope that makes sense.
> >
> > Vic
> >
> > --- In flexcoders@yahoogroups.com, "hank williams" <hank777@> wrote:
> > >
> > > Someone will probably answer this question and make it totally clear
> > > to me, but what are you talking about. By that I mean is this FDS
> > > related? I use FDS, but only for remoting and so have not yet
set up a
> > > Data Service, and I am just curious.
> > >
> > > Hank
> > >
> > > On 9/25/06, passive_thoughts <passive_thoughts@> wrote:
> > > > Can anyone provide an example of what the metadata section of my
> > > > destinations should look like in a many-to-many scenario?
> > > >
> > > > 3 tables: patient, doctor, doctorpatient
> > > >
> > > > patient can have many doctors, doctor can have many patients.
> > > >
> > > > I'd like to implement lazy loading as well, only calling up
doctors on
> > > > a patient when user requests it, as well as the reverse.
> > > >
> > > > Here's my guess...
> > > >
> > > > for destination patient:
> > > > <many-to-many property="docpatient"
> > > > destination="app.medical.docpatient" lazy="false"/>
> > > >
> > > > for destination doctor:
> > > > <many-to-many property="docpatient"
> > > > destination="app.medical.docpatient" lazy="false"/>
> > > >
> > > > for destination docpatient (do i need this?):
> > > > <many-to-one property="patient" destination="app.medical.patient"
> > > > lazy="false"/>
> > > > <many-to-one property="doctor" destination="app.medical.doctor"
> > > > lazy="false"/>
> > > >
> > > > My mind is fried. Please help.
> > > >
> > > > Vic
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Flexcoders Mailing List
> > > > FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > > > Search Archives:
> > http://www.mail-archive.com/flexcoders%40yahoogroups.com
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >
> >
> >
> >
> >
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> 
> 
> -- 
> Rich Tretola
> <mx:EverythingFlex/>
> http://www.EverythingFlex.com
>


Reply via email to