order « Fetch « JPA Q&A





1. Hibernate uses 5 queries to retrieve ordered results    forum.hibernate.org

...

2. HQL with join fetch ignores order by clause    forum.hibernate.org

I think I got your point there. The type of Country.state was java.util.Set, so it couldn't keep a sorted order. Changed it to LinkedHashSet (as you can see in the code below Code: public abstract class BaseCountry implements Comparable, Serializable { // primary key private java.lang.Integer id; // fields ...

3. Fetching records in a given order    forum.hibernate.org

How could one go about writing a query that returns a list of records in the order their IDs were given? The query "select * from foo where id in (38, 13, 2)" would return those records but in the order 2, 13, 38. This isn't what I want. Clearly I could loop over my IDs and perform a single fetch ...

4. Left Fetch Join and Order By    forum.hibernate.org

3.1.1 MySQL 5.0 Hi All, I have a question on ordering while using left fetch join. I have two tables with a one-many relationship as follows : table2.empId has a foreign key to table1.empId table1.getEmpId() returns a collection of empId table1 ---------- empId name active table2 ---------- id empId showOrder city I do the following query FROM Table1 AS tb1 LEFT ...

5. left join fetch. How do you order the collection fetched?    forum.hibernate.org

select distinct q from Question q left join fetch q.responses where q.user.username = :uName and q.type = :qType order by q.created desc