Here’s the situation…
I have a User entity which has relationships such as Messages and Posts.
When I’m in my Flex app, I want to retrieve the current user with their messages and posts, I make a request and return the ORM entity where all relationships have remotingFetch=“true”. All of the data I want is returned in a User object that is automatically matched to a class in my Flex app (via a remote class metadata annotation).
This works well.
However, when I want to search/find messages/posts from other users, I’m faced with a problem. Either I have remotingFetch turned off on the User relationship on the Messages and Posts and NO user data for those items gets returned OR I get the entire crazy tree of data, which can be very large. I still want the high-level user details, but not every related entity to those users.
This is not good.
Also, i’ve noticed that lazy fetching makes no difference for AMF serialization.
So my current solution is to turn remotingFetch off for the relationships on the User entity and have a second remoting call that loads all of the current user’s data and I manually populate the user object in my flex app from that call. It seems like there has to be a way to do this without having to resort to a lot of manual data manipulation to get the needed data.
Anyone have any best practices or ideas they could share around getting this data in an efficient/minimal-coding/minimal-requests type of way?