2017-02-23 65 views
-1

我在我的JPA存儲庫中有這個查詢 - 它工作除了「order by」部分。我做錯了嗎?在hql中它有什麼不同?排序方式在@Query選擇不起作用

@Query(value = "select wm.WagerIdentification, wm.BoardNumber, wm.MarkSequenceNumber, wm.MarkNumber," + 
     " pt.CouponTypeIdentification, pt.WagerBoardQuickPickMarksBoard " + 
     "from WagerBoard wb " + 
     "inner join wb.listOfWagerMarks wm " + 
     "inner join wb.poolgameTransaction pt " + 
     "where wb.WagerIdentification = wm.WagerIdentification and wb.BoardNumber = wm.BoardNumber and wb.GameIdentification = wm.GameIdentification and wm.meta_IsCurrent = 1 " + 
     "and wb.TransactionIdentification = pt.TransactionIdentification and pt.meta_IsCurrent = 1 " + 
     "and wb.meta_IsCurrent = 1 order by wm.WagerIdentification asc, wm.BoardNumber asc, wm.MarkNumber asc") 
+0

什麼代碼由'@ Query'註釋? (你使用'List'?) – 2017-02-23 12:24:09

+0

@RC。 List findAllTest(); –

+2

而不是在'@ Query'中對結果進行排序,您可以添加類型爲Sort的方法參數,就像在Spring Data JPA中一樣 - https://docs.spring.io/spring-data/jpa/docs/current/reference /html/#jpa.query-methods.sorting –

回答