Announcement Announcement Module
Collapse
No announcement yet.
Sort with null values Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sort with null values

    Hello,

    I am using a JpaRepository with hibernate. I am building my queries using the @Query notation so something like this (I simplified the query):


    @Query("FROM Stuff s where s.status = ?1")
    List<Items>findItems(String status, Sort sort);

    This works great till I do a sort on a column with null values in it. Any items with a null for this field are not returned. Is there a way around this? I want the items with the null values returned in the sorted list.

    Thanks.
    Last edited by jonsnow; Jun 13th, 2012, 02:45 PM.

  • #2
    I switched my method over to use the Pagination parameter discussed here:
    http://static.springsource.org/sprin...ial-parameters

    and here

    http://blog.springsource.org/2011/02...ring-data-jpa/


    I turned show_sql on and I ran the sql directly against my database and the null values are returned. Could the problem be some sort of hibernate config issue, and is nothing to do with JPA?

    Thanks.

    Comment

    Working...
    X