-->
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.  [ 5 posts ] 
Author Message
 Post subject: Not fetching relations possible?
PostPosted: Wed Nov 19, 2003 4:26 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
Hi all,

I have a non-lazy graph of class A having collection of B and C. In one occation I wanted to force Hibernate to ONLY load A.

I.e: s.find("from A as a where a.name = ?"....)

But this, of course, fetches A and everything related.

Any ideas how to fetch A only, using find?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 5:28 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
So I tried


A a = (A) s.find("select a.id, a.name from A as a where a.name = ?", thename, Hibernate.STRING).get(0)

but that gives me a classcastexception...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 7:24 am 
Newbie

Joined: Fri Oct 31, 2003 8:35 am
Posts: 2
Try to see the Java type that 'find' is returning. I think it

_________________
Sun Certified Java Programmer


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 7:38 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
Argrhag. Stupid me.

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 8:28 am 
Newbie

Joined: Thu Oct 23, 2003 6:12 am
Posts: 18
Thanks, that fixed it, it was an int

Bas


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