crud
crud copied to clipboard
Nested filters on Oracle don't work
When executing a nested filter query (https://github.com/nestjsx/crud/wiki/Requests#filter) on a oracle database i get the following error:
Error: ORA-22806: not an object or REF
The reason is the dot notation "boss.name" from the filter, that ist used in the SQL reference as "andWhereboss.name5388566708706500"
Example:
WHERE ("boss"."ENAME" = :andWhereboss.name5388566708706500) ORDER BY "EmployeeEntity"."ENAME" A
SC -- PARAMETERS: ["SCOTT"]
Unfortunately Oracle is not happy with the "." in the reference.
A possible solution, that in my case works could be to remove the "." from the reference with ${i.replace(/\./g,'')}
.
See file: https://github.com/nestjsx/crud/blob/master/packages/crud-typeorm/src/typeorm-crud.service.ts Line: 531
setAndWhere(cond, i, builder) {
const { str, params } = this.mapOperatorsToQuery(cond, `andWhere${i.replace(/\./g,'')}`);
builder.andWhere(str, params);
}
Please let me know what you think about this.
I'm still having the same issue, have you found a solution @steeu ?