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 [email protected], "hank williams" <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/