iterate « Query « JPA Q&A





1. Should I iterate over hibernate collections to find an entity, or use criteria    stackoverflow.com

What is the convention for this? Say for example I have the following, where an item bid can only be a bid on one item:

public class Item {
    ...

2. Hibernate Session find vs iterate??    coderanch.com

3. Query iterate() not supporting setFirstResult() method...?    forum.hibernate.org

Hi friends, I tried below code. In this, it is not honoring the firstResult() method for query.iterate(). But it is fetching data only based on maximum record property of query object. Code: Query query2 = session.createQuery("from Account as c where c.id = '2000'"); query2.setCacheable(true); query2.setMaxResults(10); ...

4. Iterating ScrollableResults in Service Layer    forum.hibernate.org

In one of my DAO objects, a method exists where a scrollable result set is created based on an entity object and some criteria and then the result set is iterated over to perform some necessary business logic on the data retrieved. The purpose of this code was to iterate over a large result set of data but allowing the objects ...

5. HQL , query.iterate(), iterator.next() SQL select pre row    forum.hibernate.org

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

6. Query.scroll() slow iterating result set    forum.hibernate.org

Beginner Joined: Thu Nov 20, 2003 1:30 pm Posts: 27 I have a really simple problem, I have a query where I get a bunch of PanelSurvey objects, then I want to traverse the results. It works, but its AWFULLY slow. Here are the series of event according to hibernate's logging: 1. The select statement to return all the PanelSurvey object ...

7. Problem iterating through large query results    forum.hibernate.org

8. Strange behaviour on Session.evict when using query.iterate    forum.hibernate.org

Need help with Hibernate? Read this first: I was having problems to evict an instance from session, after double checking my classes equals and hashCode I started looking through the tests that came on the distribution (Hibernate 3.0.5). So, after looking through the tests of batch fetch I realized that my classes equals and hashCode were fine after being successful on ...

9. query.iterate() return an endless Iterator    forum.hibernate.org

Hi, I've a problem with a query.iterate() method. This used to work before I migrated to Hibernate3.0.5: HQL Query: Code: select Profession.id, Profession.professionLibelleApe, clazz.tauxCotisationAnneeSalariale, Profession.professionEtatActivation, Profession.professionDateSuppression from clazz in class org.xx.common.model.profession.TauxCotisation left join clazz.tauxCotisationProfessionCodeApeFk as Profession where (( Profession.professionLibelleApe like '%%' )) AND ((clazz.tauxCotisationAnneeSalariale like '%' ) ) AND ((Profession.id like '%' ) ...





10. help in iterating a result set for a particular query    forum.hibernate.org

hi, I tried reading the information on the web and hibernate docs but I could not understand how to iterate through a result set in teh following scenario: I have 2 tables Customers and Orders. I created 2 POJOs corresponding to those tables. Now, I would like to execute a query say (in SQL systax) Select c.name, c.email, o.orderID, o.OrderName from ...

11. Query.iterate() regression in Hibernate 3.1.1    forum.hibernate.org

JDBC driver:MySQL Connector/J 3.1.12 Hibernate version: 3.1.0 or 3.1.1 Source code sniplet: Code: HibernateHelper hibernateHelper = HibernateHelper.getInstance(); Session session = hibernateHelper.getSession(); Query getImages = session.createQuery("from " + ServerOriginalImage.class.getName() + " as image where " + ...

12. session object does not have iterate or find methods    forum.hibernate.org

Hibernate version: 3.1.3 Hello, I'm reading through the documentation and in Chapter 14 Tips and Tricks I see: You can count the number of query results without actually returning them: ( (Integer) session.iterate("select count(*) from ....").next() ).intValue() When I try this: Code between sessionFactory.openSession() and session.close(): Session session = HibernateUtil.getSessionFactory().getCurrentSession(); ((Integer)session.iterate("select count(*) from Users where username = '" + username + ...

14. Query.iterate() ignores class-level lazy="false"?    forum.hibernate.org

Hibernate version: 3.2 I've got lazy="false" in my element of my hibernate mapping file. I did this when proxying became the default behavior in 3.0. Unfortunately, now I have a case where the same query run via .list() returns me non-proxied objects... but calling .iterate() returns me CGLib proxies. I can't find anywhere this behavior is documented, or expected. Is ...

15. The DB exception : could not execute query using iterate    forum.hibernate.org

Hi All, i am using hibernate. My problem is that when i am using the methods which gets me the data from the database locally using the User Interface is working fine. But i am calling this method using RMI it is giving exception which is like this. The DB exception is : could not execute query using iterate My code ...

16. BUG? Query.iterate() not returning proxies when it should    forum.hibernate.org

Iterator i = session.createQuery( "FROM Cat WHERE id=1" ).iterate(); Cat c = (Cat) i.next(); assertTrue( c instanceof HibernateProxy );