-->
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: HQL , query.iterate(), iterator.next() SQL select pre row
PostPosted: Fri Jan 23, 2004 4:33 am 
Newbie

Joined: Fri Jan 23, 2004 4:02 am
Posts: 6
Location: Linz, Austria
I'm new to hibernate and have been exploring the query mechanisms.

When I use HQL like below

Query query = session.createQuery("select cat from Cat as cat where cat.sex = :sex");
query.setCharacter("sex", 'F');
for (Iterator it = query.iterate(); it.hasNext();) {
Cat cat = (Cat) it.next();
out.println("Female Cat: " + cat.getName() );
}


each call of it.next() issues a SQL SELECT to retrieve the row object using the primary key. Is there a way (with HQL) that only a single SQL SELECT (selecting all attributes) is issued (for better performance).
What is the reasoning for such a behaviour - maybe I just do not have the right configuration?

I have also played with the citeria API which seems to issue only a single SQL SELECT to return the complete object set.

I'm using a Firebird 1.x database with the JayBird JDBC Driver/JDK 1.4.x

Thanks
Martin


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 23, 2004 4:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Use query.list()


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.