-
In the
But when I do: public async findId(id: string | number): Promise<Book | null> {
await this.repository.findOne({ id: { $eq: id as number } });
return this.repository.findOne({ id: { $eq: id as number } });
} In the debug I can see: [query] select `e0`.* from `book` as `e0` where `e0`.`id` = '7' limit 1 [took 3 ms]
[query] select `e0`.* from `book` as `e0` where `e0`.`id` = '7' limit 1 [took 2 ms] So, how or where happens the "skipping loading of already loaded entities"? |
Beta Was this translation helpful? Give feedback.
Answered by
B4nan
Apr 25, 2021
Replies: 1 comment 1 reply
-
You need to load by PK, just by the value. There is no query processing, so anything more complex will always do the query. public async findId(id: string | number): Promise<Book | null> {
await this.repository.findOne(id as number);
return this.repository.findOne(id as number);
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
alexojegu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to load by PK, just by the value. There is no query processing, so anything more complex will always do the query.