-->
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: Using eager fetching for certain queries
PostPosted: Tue Sep 26, 2006 10:52 am 
Newbie

Joined: Fri Jun 16, 2006 3:41 pm
Posts: 18
Hi,
I want to query some data from the database, manipulate it a bit and display it. The problem is the objects are in persistent state after the query and hibernate starts trying to update the database (getting an exception because I set login rights to readonly).

So I used transaction.commit() right after the query so hopefully the objects are in detached state and I will change them and throw away the changes. But now I get a bunch of lazy evaluation exceptions because I didn't join fetch all the sets. If I join fetch everything that I need the query takes ages to execute.

What can I do?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 5:37 pm 
Beginner
Beginner

Joined: Mon Aug 15, 2005 10:20 am
Posts: 32
Location: Brazil
You need to use FlushMode.NEVER instead of commiting the transaction.


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.