-->
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.  [ 3 posts ] 
Author Message
 Post subject: Load only the part of the object desired
PostPosted: Thu Feb 11, 2010 6:03 am 
Newbie

Joined: Thu Feb 11, 2010 5:53 am
Posts: 5
Hi,

If I do a hibernate load, the whole object gets loaded with an SQL query involving all the columns of the table. Hpwever, I am interested in only certain part of the Object i.e. a few columns. Can I not pass in these column information, get back an Object and expect to have the info I asked for, with the rest of the object containing default/null values?

My table contains 200 columns(really!).

-thanks


Top
 Profile  
 
 Post subject: Re: Load only the part of the object desired
PostPosted: Thu Feb 11, 2010 6:11 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
You can use projection queries for this purpose.
You can also define a ResultTransformer in order to get returned an object instead of an array of values.
See Book "Java Persistence with Hibernate" chapter 15.1.3 Projection and report queries.


Top
 Profile  
 
 Post subject: Re: Load only the part of the object desired
PostPosted: Thu Feb 11, 2010 3:05 pm 
Newbie

Joined: Thu Feb 11, 2010 5:53 am
Posts: 5
great! that did the trick. thanks :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.