如何在@query存储库中获取@param的大小JPA
我有一个问题,这是我想知道 @param 的大小,我传递给 @query ,但它在编译时给我以下错误:
unexpected token: : near line 1
我向您显示我的查询的代码:
@Query(
value = "SELECT DISTINCT company "
+ " FROM Company company "
+ " left join company.companyProducts products "
+ " inner join empresa.servicios services "
+ " WHERE services.idService IN (:idsServices) "
+ " AND products.id.idProduct IS NOT NULL "
+ " AND ( (:idsProducts IS NOT NULL AND COUNT(:idsProducts)>0)"
+ ") OR productos.id.idProduct IN (:idsProducts)) ")
List<EmpresaGrupo> obtenerEmpresasProductoServicio(@Param("idsProducts") List<Integer>
idsProducts,
@Param("idsServices") List<Integer> idsServices);
错误在我进行@Param的计数的位置直接跳跃:
(:idsProducts IS NOT NULL AND COUNT(:idsProducts)>0)
感谢您的帮助
I have a question and it is that I want to know the size of a @Param that I pass to the @Query but it gives me the following error when compiling:
unexpected token: : near line 1
I show you the code of my query:
@Query(
value = "SELECT DISTINCT company "
+ " FROM Company company "
+ " left join company.companyProducts products "
+ " inner join empresa.servicios services "
+ " WHERE services.idService IN (:idsServices) "
+ " AND products.id.idProduct IS NOT NULL "
+ " AND ( (:idsProducts IS NOT NULL AND COUNT(:idsProducts)>0)"
+ ") OR productos.id.idProduct IN (:idsProducts)) ")
List<EmpresaGrupo> obtenerEmpresasProductoServicio(@Param("idsProducts") List<Integer>
idsProducts,
@Param("idsServices") List<Integer> idsServices);
The error jumps right where I do the Count of the @Param:
(:idsProducts IS NOT NULL AND COUNT(:idsProducts)>0)
Thanks for help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论