-->
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.  [ 4 posts ] 
Author Message
 Post subject: How to not use Proxy for Object with HQL Query
PostPosted: Tue Dec 09, 2003 12:13 pm 
Beginner
Beginner

Joined: Sat Dec 06, 2003 5:38 pm
Posts: 27
Hi all,

I have an HQL query: select db from Daughterboard db where db.scintillationFileNumber=? that when it didn't find a match used to throw an ObjectNotFoundException. Now however I have a proxy, so it waits until first used to throw a LazyInitializationException.

Is there any way in the HQL to force the load, and make it eager? I could in my result iterator through and call a method to force the load.. I am using 2.1 RC1

Eric


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2003 12:18 pm 
Beginner
Beginner

Joined: Sat Dec 06, 2003 5:38 pm
Posts: 27
I'm sorry, I looked at it again, cause I didn't understand how the hql could be lazy for the object being looked up, and released it was standard lookup:
session.load(Daughterboard.class, new Long(daughterboardId));

In this case, I want it to be an eager load, not a proxy load b/c my business logic makes a decision on if it is exists or not..

Eric


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2003 12:50 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Hibernate.initialize()

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2003 1:58 pm 
Beginner
Beginner

Joined: Sat Dec 06, 2003 5:38 pm
Posts: 27
That was it! I was looking for an HQL statement.. Thanks...


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