'How to get the size of @Param in @Query Repositories JPA
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
