size « Query « JPA Q&A





1. Hibernate Criteria API - how to order by collection size?    stackoverflow.com

Assuming I have classes User and UserGroup. There is an optional 1-many group to user association and the association is mapped from both sides (the UserGroup side via a property called ...

2. Hibernate: page results AND know the result size    stackoverflow.com

I'm doing a directory listing using Hibernate and, to avoid having tons of data every query, I'm using:

Criteria paging = sess.createCriteria(Principal.class);
paging.setFirstResult((int) resultSetStart);
paging.setMaxResults(resultSetSize);
...
List<Principal> principals = paging.list();
Now, this works fine: I guess exactly ...

3. Convert hibernate HQL with collection.size to criteria query    stackoverflow.com

For some reason I can never figure out how to do things via criteria api. I have a HQL:

from Track track where size(track.trackTitles) > 1
Is it possible to convert it into a ...

4. Is there a way to get the count size for a JPA Named Query with a result set?    stackoverflow.com

I like the idea of Named Queries in JPA for static queries I'm going to do, but I often want to get the count result for the query as well as ...

5. Hibernate Hql find result size for paginator    stackoverflow.com

I need to add paginator for my Hibernate application. I applied it to some of my database operations which I perform using Criteria by setting Projection.count().This is working fine. But when I ...

6. HQL Query to check if size of collection is 0 or empty    stackoverflow.com

I try to generate a HQL query that include user with a empty appoinment collections(mapped by OneToMany):

SELECT u FROM User u JOIN u.appointments uas WHERE u.status = 1 AND (uas.time.end < ...

7. Finding the total result size using Hibernate Query and pagination    coderanch.com

All, I'm using Hibernate/HQL/named queries to retrieve data from a database. In particular I use pagination (i.e. I control the number of results that are returned on any one query) so as not to pull thousands of rows from the database. Here's the java code I have right now: @SuppressWarnings("unchecked") public final AlarmQueryResponse findAll(AlarmQuery alarmQuery) { // attempt to retrieve the ...

8. limit size of sub query in HQL query    forum.hibernate.org

9. How to get the size of a ScrollableResults    forum.hibernate.org

With your advice, I'd like to use the index() HQL function to randomly get objects from a query, but that's only implemented in 2.1.X. So I have to use ScrollableResults to gain comparable performance. Now I want to randomly select questions from a huge number of questions out of some query. I need the query result size to generate an random ...





10. how to order by the size of a collection?    forum.hibernate.org

11. select by size of a collection property    forum.hibernate.org

I am trying to do a select based on the size of a collection of collections property. For example, I have a ClassA that has a one-to-many relationship with ClassB. And class B has a one-to-many relationship with ClassC. What I want to do is the following from ClassA c where c.myClassBs.classBsCcollection.size>1. So, I want all ClassA instances where the size ...

12. Order on collection size, "Invalid use of group functio    forum.hibernate.org

I'm trying to select and order by collection size. After two hours of trying to use the examples at [1], I thought i should turn in for help :-) Consider a class House with a set of residents like : I tried ...

13. hql size with where clause    forum.hibernate.org

14. createQuery throws parse exception if it contains 'size'    forum.hibernate.org

Full stack trace of any exception that occurs: Code: java.lang.StringIndexOutOfBoundsException: String index out of range: -5 at java.lang.String.substring(String.java:1768) at java.lang.String.substring(String.java:1735) at org.hibernate.hql.CollectionSubqueryFactory.createCollectionSubquery(CollectionSubqueryFactory.java:32) at org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:300) at org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:290) at org.hibernate.hql.ast.tree.FromElement.toColumns(FromElement.java:376) at org.hibernate.hql.ast.tree.DotNode.getColumns(DotNode.java:97) at org.hibernate.hql.ast.tree.DotNode.initText(DotNode.java:210) at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:204) ...

15. ordering results by collection size    forum.hibernate.org

I want to order my results by the size of their child collection. there is example on Hibernate Tips and Tricks and it says this. select user from User user left join user.messages msg group by user order by count(msg) so, its ok, but I am using Criteria api and my query looks like this: Criteria cr=session.createCriteria(hr.klopa.domain.FoodProvider.class); Foodprovider has collection "menuGroups", ...

16. Limiting size of query results set    forum.hibernate.org

public List getIntellectualPropertyByQuery(String query) { // set limit getHibernateTemplate().setMaxResults(Integer.parseInt(Constants.SEARCH_LIMIT)); return getHibernateTemplate().find( query ); }





17. How to criteria query the size of a collection?    forum.hibernate.org

18. Criteria API: ordering by collection size    forum.hibernate.org

Welcome, I am trying to learn Criteria API with demo application. I have two many-to-many bidirectional association: class Event { ... private Set participants; ... /* getters and setters */ } class Person { ... private Set events; ... /* getters and setters */ } They're mapped with many-to-many almost like in tutorial and everything works great. But how can I ...

19. Criteria Query result set size    forum.hibernate.org

Hi, I would like to retreive the size of a criteria query result set but I dont seem to find a way to do it. For example there are around 70,000 entries in my table, I use a criteria query to filter it down to may be around 15,000 entries. If I try to pull all the 15,000 entries it throws ...

20. Using the Criteria API to order results by collection size?    forum.hibernate.org

For those interested, it turned out that there was no good solution to this. Even hand-building queries via HQL was extremely painful, since in order to reconstitute the list of returned objects I had to enumerate all of the attributes of the object and its ancestors in the select statement. And then even that broke, since it didn't properly order "Users" ...

21. Incorrect count of association size    forum.hibernate.org

Hibernate version: 3.2.1 GA It seems that Hibernate is incorrectly computing the size of an association in a particular case. I have an entity "List" that has a set of "Users" (subscribers). Users have an "information" field that is NULLABLE. When I do myList.getSubscribers().size() it generates a correct query but counts the non NULL lines and returns an incorrect count. Adding ...

23. Maximum size for in clause in HQL    forum.hibernate.org

HI I have a query like From Person where id in ( x,y,...) where i have many (like 10000 or more ids in the in clause) the HQL parser laughs at that and throws a stackoverflowexception. I now build smaller queries which 1000 ids thats fine. does anyone know how much ids i can give there to minimize the number of ...

24. Order by collection size with criteria    forum.hibernate.org

25. ORDER BY : Size of Set    forum.hibernate.org