-->
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.  [ 13 posts ] 
Author Message
 Post subject: Get single object
PostPosted: Wed Nov 19, 2003 8:42 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
How can I retrieve a single object, without its associations to other objects?

That is, prevent joining collections, many-to-one's, etc...

Need this for performance in certain situations..

find appears to take the whole graph whatever I do. I'm using non-lazy setups.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 9:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Your only choice is to use proxies (Lazy) or use a data object and load it using a find query, eg, s.find("select new DataObject(t.arg1, t.arg2) from Table as t");


Top
 Profile  
 
 Post subject: Re: Get single object
PostPosted: Wed Nov 19, 2003 10:21 am 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
nickvajberg wrote:
How can I retrieve a single object, without its associations to other objects?

That is, prevent joining collections, many-to-one's, etc...

Need this for performance in certain situations..

find appears to take the whole graph whatever I do. I'm using non-lazy setups.


In your mapping files, for every "set" use lazy="true". This way, when you load a object, the associated "set" is not loaded at this time.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 10:21 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
Would it be hard to add a "nojoin" construct?

I.e.: "from Lady as lady nojoin where lady.name = 'Cindy'"

That would be extremely useful (no sql pun intended)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 10:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
HQL queries do not do any joins that you do not explicitly request - so this construct would be useless.


Top
 Profile  
 
 Post subject: Re: Get single object
PostPosted: Wed Nov 19, 2003 3:24 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
nerotnt wrote:
nickvajberg wrote:
How can I retrieve a single object, without its associations to other objects?

That is, prevent joining collections, many-to-one's, etc...

Need this for performance in certain situations..

find appears to take the whole graph whatever I do. I'm using non-lazy setups.


In your mapping files, for every "set" use lazy="true". This way, when you load a object, the associated "set" is not loaded at this time.


I said non-lazy, didn't I?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 3:25 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
gavin wrote:
HQL queries do not do any joins that you do not explicitly request - so this construct would be useless.


It would override non-lazyness. Pretty darn useful, if you ask me.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 3:26 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You can modify the Hibernate source, can't you?

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2003 6:49 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
Useful answer.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2003 6:59 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Thats the power of Open Source.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2003 7:12 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
But only if you have time...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2003 7:23 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
But only if you have time...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2003 7:24 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Like, we have to answer you questions, even if they don't make much sense? :)

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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