I want to get the rows from Communication
table whose appointment_type_ids
list contains Integer
.
Communication.java
@Getter
@Setter
@Entity
@Table(name = "communication")
public class Communication{
@Column("id")
private Long id;
@Column("name")
private String name;
@Column("appointment_type_ids")
private List<Integer> appointmentTypeIds;
}
CommunicationRepository.java
@Repository
public interface CommunicationRepository extends JpaRepository<Communication, Long>,
QuerydslPredicateExecutor<Communication>, JpaSpecificationExecutor<Communication> {
@Query("SELECT c FROM communication c WHERE ?1 = ANY(c.appointment_type_ids)")
List<Communication> findAppointments(Integer integer);
}
I am getting the following error
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: c near line 1, column 56 [SELECT c FROM communication c WHERE ?1 = ANY(c.appointment_type_ids)]
How can I solve this?