Код: Выделить всё
@Query(value = "SELECT * FROM ballots b WHERE b.companies && :companyIds and b.meeting_id in :meetingIds", nativeQuery = true)
List findByIds(Long[] companyIds, Long[] meetingIds);
< /code>
Вот моя сущность: < /p>
@Table(name="ballots")
public class Ballot {
@Id
private long id;
@Column
private long meetingId;
@Type(ListArrayType.class)
@Column(name = "companies",columnDefinition = "bigint[]")
private List companies = new ArrayList();
}
< /code>
Вот как я называю метод: < /p>
private final BallotRepository ballotRepo;
public void findBallots(Set companyIds, Set companyMeetingIds) {
List ballots = ballotRepository.findByIds(companyIds, companyMeetingIds);
// the rest of the code
}
}
< /code>
Подпись метода с < /p>
[list]
[*]Long[] companyIds, Long[] meetingIds[*]
Код: Выделить всё
Long[] companyIds, Collection meetingIds[*]
Код: Выделить всё
Collection companyIds, Collection meetingIds[/list]
Код: Выделить всё
org.springframework.dao.InvalidDataAccessResourceUsageException: JDBC exception executing SQL [SELECT * FROM ballots b WHERE b.companies && (?) and b.meeting_id in (?,?)] [ERROR: operator does not exist: bigint[] && bigint
Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
Position: 42] [n/a]; SQL [n/a]
Подробнее здесь: https://stackoverflow.com/questions/797 ... ong-but-no