clwandling wrote:
pksiv wrote:
... if you're using a rich client, it's probably best to use long-running Hibernate sessions. Just keep the session open and Hibernate will only load the data the client requests, when it requests it.
But that assumes that Hibernate and the database are running on the client. It does not work for mobile objects.
I've never heard anyone use the term "mobile objects" before so that was throwing me off.
This is actually a similar situation to using an EJB Session Facade layer on the back end. If you transmit the objects, you have to initialize them as "fully as the client needs" prior to sending them. There is NO way to get around the fact that you've passed the object to a different JVM.
Hibernate does have methods that the client could use to see if things were initialized before it tried to use them - Hibernate.isInitialized(Object proxy) and Hibernate.isPropertyInitialized(Object entity, String propertyName) - but I don't see how it would help your client to know that the fields weren't initialized if another call to the server wasn't going to initialize them anyway.
You need to code your server methods for very fine-grained tasks which will initialize all the fields that the given UI requires.