【发布时间】:2014-11-16 11:35:19
【问题描述】:
我知道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!)。我的课是:
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-jpa 将无济于事,则该错误在 spring-data-commons 中。
-
那些 java.lang 的家伙需要冷静下来......
标签: java spring spring-mvc jpa spring-data