Code: Select all
@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>
Hier ist meine Entität: < /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>
Hier erfahren Sie, wie ich die Methode nenne: < /p>
private final BallotRepository ballotRepo;
public void findBallots(Set companyIds, Set companyMeetingIds) {
List ballots = ballotRepository.findByIds(companyIds, companyMeetingIds);
// the rest of the code
}
}
fehlgeschlagen
Code: Select all
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]