Jun 11th, 2012, 01:51 PM
Sort with null values
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.
Last edited by jonsnow; Jun 13th, 2012 at 01:45 PM.
Jun 14th, 2012, 02:43 PM
I switched my method over to use the Pagination parameter discussed here:
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?