So I've been working on this problem with RequestFactory and Lazy
Loading. I am using a Service Layer to deal with operations on Domain
Objects. I ran into a problem when I was trying to "merge" an object
with my Hibernate Domain layer. Hibernate was throwing a "lazy
loading" error ("Failed to lazily initialize a collection"). The
problem was when I fetched an object via RequestFactory it did not
come with its relationships. So if I had a Donor with a collection of
Donations, the Donations do not come with the initial fetch unless
specified (i.e.
requestFactory.donorRequest().fetch(id).with("donations")). When I
removed the relationship from the Proxy Domain Object (so removing the
methods getDonations and setDonations from the DonorProxy), I did not
have this problem. The merge worked fine. Why is this the case?Second, if this is the case it would seem beneficial to remove relationships that you would normally want to lazy load from the proxies and just make an explicit call to load up the collection. So remove the getDonation and setDonation from the DonorProxy and when I need those donations just make a call with the donorId to get them. This seems counter intuitive to me, but seems also not like a terrible idea. Basically I am trading of between having to make explicit calls to load OneToMany relationships and being able to do merge's. AM I CRAZY? -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
