I am working on a master/detail workflow for a Struts app, and am using an "open session in view" pattern. On the detail screen, I pass a Hibernate object into the request, then use taglibs to display all the object attributes. Watching the generated SQL, I notice that when I lazily init the collections, Hibernate brings back the complete record for each object in the collection, even though I'm only displaying a single string attribute. I gather that lazy initializing a collection is an all-or-nothing operation. Is there some way to only pull back a single attribute from a collection? Could <element column> help here? The docs are generally great but don't really describe what element columns are for, so I'm puzzled.
As usual, any hints would be much appreciated:) Hibernate rocks!
|