I have a mildly deep object graph (5 levels), comprised of aproximately 200 objects total. I have a tree control for browsing this heirarchy. When I launch my tree viewer, I only want to see the root nodes. With SQL tracing on, I see that I'm getting the entire object graphs loaded as a result of my session.find().
I have proxies set throughout, and my collections declare lazy="true".
The method that does the lookup looks like this (error processing removed):
Code:
public List findRootNodes() {
s = SessionManager.getSessionFactory().openSession();
results = s.find("from RootNode");
s.close();
return results
}
Is there something else I need to do to get the objects to load only when I access them (i.e. keep the session open during user browsing)?
Thanks.
FWIW, this is a thick-client application talking directly to the database.