@javax.persistence.Entity
public class Device extends AbstractEntity implements Serializable {
@ElementCollection
@LazyCollection(LazyCollectionOption.FALSE)
private List<String> labels;
}
Now I need to check whether what are the devices existing for the given label set.
Below are the querirs that I tried.
@Query("SELECT DISTINCT d FROM Device d JOIN d.labels l WHERE d.entity.id IN :entity_ids AND l IN :labels ")
List<Device> find(@Param("entity_ids") Set<Long> entityIds, @Param("labels") Set<String> labels);
@Query("SELECT d FROM Device d WHERE d.entity.id IN :entity_ids AND d.labels IN :labels") List<Device>
find(@Param("entity_ids") Set<Long> entityIds, @Param("labels") Set<String> labels);
This ended up with en error.
org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [D2_label1] did not match expected type [java.util.Collection (n/a)]; nested exception is java.lang.IllegalArgumentException: Parameter value [D2_label1] did not match expected type [java.util.Collection (n/a)] at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:373) at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:255)
Can anyone suggest me a solution?