Sort « Field « JPA Q&A





1. Hibernate: Sorting by a field from a linked table if foreign key is null    stackoverflow.com

Lets say I have two tables - "Cat" and "Cat owner" that are linked with many-to-one like this:

<class name="com.example.Cat" table="cat">
     ... 
     <many-to-one ...

2. How to Sort By sub field    forum.hibernate.org

3. Problem when sorting on a field that contains null    forum.hibernate.org

Newbie Joined: Fri Sep 23, 2005 9:30 am Posts: 7 Hello, I am trying to sort on a field that can be null. when i sort on this field, none of the objects with the null field are returned. If i don't sort, then all the objects are returned. In concrete terms, in the mapping, etc.. below, i have the following ...

4. Sorting on Foregin Object's field    forum.hibernate.org

In a many-to-one relationship, let say the entities are User and Organization where one organization may have thousands of users and user may not have an organization. In the User.hbm.xml, I set fetch="join" in the tag. The SQL generated for fetching the User uses LEFT OUTER JOIN. However, If I perform a query on User with a sorting option ...

5. Sorting fields of nText type    forum.hibernate.org

Thanks for your reply. I've tried the following from your response. Hmm, i think i'm getting close.. My basic idea is really to cast any "nText/clob" to something sortable. But none of the syntax from the various forums seem to work... Or is there another approach 1) "from Cat c order by (cast(c.description as varchar(4000))) ASC" output: returns the same exception ...