RE: [flexcoders] Flex 2 DS shared Managed Objects question

2006-08-05 Thread Jeff Vroom












Answers inline:











From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of thunderstumpgesatwork
Sent: Friday, August 04, 2006 8:04
AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex 2 DS
shared Managed Objects question











I'm using Data Services with Managed Objects and the
Hibernate Assembler.

I have a question regarding updating a shared managed object through
one managed object, and having that update be reflected in another
managed object. Should this work?

I the most simple case, lets say I have a managed object A, that when
fetched has a collection of other managed objects B. If I add a new
managed object B, and save it directly through it's DataService,
shouldn't A refresh its collection of B objects? 

When you are using an association
property, you need to explicitly modify that property for it to change. The
auto refresh behavior of collections only works for collections which
you populate using the DataService.fill method. So in this case, you would
have to both create a new B and add it to As collection of Bs for
the A.Bcollection property to update. This could be done on the client, or
you could do it in on the server using the DataServiceTransaction api. It
might look at the newly created B and issue updateItem calls for the A destination
updating the collection property to include the new B. Assuming autoSyncEnabled
was true for the fill/getItem that created A, this would then push out the changes
to As collection of Bs so it shows up.

I suppose that if adding B
has a side effect of updating the state of a property of A because of a
relationship in the database, simply refreshing A would also get the new version
of the data (i.e. call fill or getItem again)

In a more complex sense, I have managed objects that are shared
components of several other managed objects. (A's contain a collection
of B's)... when I update a B, do I need to keep track of every A that
has that particular B?

Yes, if you are using
association properties this is by manually updating association properties. Another
approach is to use fills instead of associations. In this case, you can
pass in the id of item A as a fill parameter to retrieve a list
of Bs instead of storing the collection of Bs as a property of A. In
this case, after each change to a B, we will go through all fills which have
auto-refresh enabled and re-execute them to see if their contents have changed.
If so, we push out the changes to the clients that have those fills. This
can be slow as the number of fills changes so there are ways to optimize that
process.

I hope this helps. Does
this work for you if you are using hibernate without FDMS? I guess
it might if you are not caching instances and refetch them from the database
each time you create a new B I think that usually you implement
this type of thing with a bi-directional relationship where B also has a
reference to one or more As. In this case, the hibernate docs recommend
that you update both sides of the relationship though only one of the
properties needs to be changed to persist the state in the database.

Jeff







 




__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___






[flexcoders] Flex 2 DS shared Managed Objects question

2006-08-04 Thread thunderstumpgesatwork
I'm using Data Services with Managed Objects and the Hibernate Assembler.

I have a question regarding updating a shared managed object through
one managed object, and having that update be reflected in another
managed object. Should this work?

I the most simple case, lets say I have a managed object A, that when
fetched has a collection of other managed objects B. If I add a new
managed object B, and save it directly through it's DataService,
shouldn't A refresh its collection of B objects? 

In a more complex sense, I have managed objects that are shared
components of several other managed objects. (A's contain a collection
of B's)... when I update a B, do I need to keep track of every A that
has that particular B?

How is this done?

thanks,
Thunder







--
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/

* 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/