Im using **typeorm **with **nestjs **to work with oracle database.
async findAll(): Promise<BRANCHE[]> { let brancheListe: BRANCHE[] = null;
try {
brancheListe = await this.brancheRepository.find();
} catch (error) {
console.log(error);
}
return brancheListe;
}
query: SELECT "Branche"."ID" AS "Branche_ID", "Branche"."BRANCHE" AS "Branche_BRANCHE", "Branche"."BRACHE_NAVN" AS "Branche_BRACHE_NAVN", "Branche"."TS" AS "Branche_TS" FROM "branche" "Branche" WHERE branche.id < :1 -- PARAMETERS: [10] query failed: SELECT "Branche"."ID" AS "Branche_ID", "Branche"."BRANCHE" AS "Branche_BRANCHE", "Branche"."BRACHE_NAVN" AS "Branche_BRACHE_NAVN", "Branche"."TS" AS "Branche_TS" FROM "branche" "Branche" WHERE branche.id < :1 -- PARAMETERS: [10] error: Error: ORA-00942: table or view does not exist
async findAll(): Promise<BRANCHE[]> { let brancheListe: BRANCHE[] = null;
try {
brancheListe = await this.brancheRepository.query(
'SELECT * FROM BRANCHE',
);
} catch (error) {
console.log(error);
}
return brancheListe;
}
I just wanna know how can stop TypeORM to put double quoutes "" for the generated sql
Allow TypeORM to use the double quotes. Instead, fix your entity so that the double quoted identifiers in the queries have the correct case (upper-case).
If you have:
@Entity()
export class Branche {
@PrimaryGeneratedColumn()
ID: number
@Column()
BRANCHE: string
@Column()
BRACHE_NAVN: string
@Column()
TS: string
}
You can try either:
@Entity()
export class BRANCHE {
...
or, specify the table name with the Entity
decorator:
@Entity("BRANCHE")
export class Branche {
...
or:
@Entity({name: "BRANCHE"})
export class Branche {
...