-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Lazy initialization on per-column basis?
PostPosted: Wed Aug 27, 2003 11:50 am 
Beginner
Beginner

Joined: Tue Aug 26, 2003 4:19 pm
Posts: 42
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!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 27, 2003 12:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
You might want to have a look at the "Lightweight" pattern described in the patterns section of the site. It is meant to handle these situations. The basic idea is to have two different objects mapped to the same table. One is simply a "lightweight" subset of the data; the other the full mapping. This is especially OK if that table is always persisted through the top-level entity (i.e., not part of a cascade).


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.