After much research, i have seen solutions people have come up with to solve this, such as http://h3t.sourceforge.net/. I also notice other products such as TopLink offer their own strategy to handle this (e.g. using javaagent with toplink-essentials-agent.jar).
I just wondered if anybody has any experience of this issue and how you decided to handle?
For examples sake, lets assume we have an object Order which lazy loads a collection of OrderItems. On the client (remote) site, we do a call to get the order items when needed. Using ejb3/hibernate, saying order.getOrderItems() would thrown an exception on the client (and rightly so). So what's approaches should be considered to get the order items?
Along with the solution i copied in above, of course the order items could be loaded on the server side before being returned to the client. However, let's assume we DON'T want to do this and only want to access this collection on the rare instance the order items are required (for arguments sake...).
Any experiences or points to provoke my thoughts would be greatly appreciated.
In my experience I solved this by (using your Order-OrderItems example): Keep the OrderItem lazy loaded; provide a method to the client that loads the OrderItems for an specific Order, and use this method instead of the getter in the Order class.
I didn't know this H3T.
subject: Hibernate EJB3 + Remote Lazy Loading Best Practices