Results 1 to 2 of 2

Thread: Sort with null values

  1. #1
    Join Date
    Jun 2012
    Posts
    2

    Default 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 at 01:45 PM.

  2. #2
    Join Date
    Jun 2012
    Posts
    2

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •