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
|
|