我有一个带有网络对象的Convention ConventionEntity实体和Object activityTypes列表
我想使用多个条件搜索约定,我使用了spring数据,所以我使用了查询搜索
在以下查询中,我遇到此错误
org.hibernate.QueryException:无法取消引用标量集合 元素:categoryPerimeter [SELECT c FROM com.softilys.entities.ConventionEntity c JOIN c.activityTypes act 在哪里act.categoryPerimeter =:perimeter AND c.network.networkName IN (:networkNames)AND c.title =:title]
@Entity
public class ConventionEntity implements Serializable {
private static final long serialVersionUID = 1L;
private String title;
private Network network;
@ElementCollection
private Set<ActivityType> activityTypes;
}
public class Network implements Serializable {
private static final long serialVersionUID = 1L;
private String networkName;
}
public class ActivityType implements Serializable {
private static final long serialVersionUID = 1L;
private String categoryPerimeter;
}
@Repository
public interface ConventionRepository extends JpaRepository<ConventionEntity, String> {
@Query("SELECT c FROM ConventionEntity c "
+ "LEFT JOIN c.activityTypes act "
+ "WHERE act.categoryPerimeter = :perimeter "
+ "AND c.network.networkName IN (:networkNames) "
+ "AND c.title = :title ")
List<ConventionEntity> searchConventions(@Param("title") String title, @Param("perimeter") String perimeter ,
@Param("networkNames") List<String> networkNames);
}