我知道this問題,但是使用org.springframework.data:spring-data-jpa:1.7.0.RELEASE
我仍然有同樣的問題(Either use @Param on all parameters except Pageable and Sort typed once, or none at all!
)。我的階級是:Pageable和@Param在彈簧數據JpaRepository方法問題[2]
public interface BalanceHistoryRepository extends JpaRepository<BalanceHistory, Long> {
@Query("select bh from BalanceHistory bh where bh.account.id = :idAccount")
public BalanceHistory findCurrentBalanceByAccountNumber(PageRequest pageCriteira, @Param("idAccount") long idAccount);
}
編輯
電話:
Pageable page = new PageRequest(0, 1, Sort.Direction.DESC, "date");
BalanceHistory bh = balanceHistoryRepository.findCurrentBalanceByAccountNumber(1,page);
方法:
@Query("select bh from BalanceHistory bh where bh.account.id = :idAccount")
public BalanceHistory findCurrentBalanceByAccountNumber(@Param("idAccount") long idAccount, Pageable pageCriteira);
這個錯誤是在spring-data-commons中,如果你依賴於較舊版本的spring-data-commons升級,spring-data-jpa將無濟於事。 – 2014-09-22 13:31:06
那些java.lang人需要冷靜下來...... – muttonUp 2016-07-19 12:18:34