0

I have created a JPA query to read the view from the oracle database in Spring Boot. It works if I set a literal value to the POLICY_REF like POLICY_REF IN ('A123I') then View returns the policy. In the log

ids: [A123I] query: [A123I]

otherwise it returns empty if I set POLICY_REF IN (:ids).

ids: [A123I] query: []

ids value is coming from the UI that is set to - ids: [A123I]

Please, any suggestion?

public HashSet<String> memberExists(final List<String> ids) {
    log.info("ids: "+ids);
    return new HashSet<String>(
            this.testJdbcTemplate
                    .query("select TRIM(POLICY_REF) from LSCHEMA.POLICY_VIEW where POLICY_REF in (:ids)",
                   Collections.singletonMap("ids", ids), this.rowMapper));
}

public boolean memberExists(final String id) {
    
    return this.memberExists(Collections.singletonList(id))
            .contains(id);
}

}

1 Answers1

0

Try removing the () you have put in the query after IN clause

Maybe this question would be of help Adding IN clause List to a JPA Query

Dilini Peiris
  • 446
  • 1
  • 6
  • 16