Closed boukmi closed 2 years ago
Hi,
I'm getting the following error when I try to implement pagination for one of my TypeORM entities: QueryFailedError: missing FROM-clause entry for table "typeormworker"
QueryFailedError: missing FROM-clause entry for table "typeormworker"
@Entity('worker') export class TypeOrmWorker extends AbstractOrmEntity { @Column({ name: 'first_name' }) firstName: string; @Column({ name: 'last_name' }) lastName: string; @Column({ unique: true }) email: string; @Column() phone: string; @Column({ name: 'date_of_birth', type: 'date' }) dateOfBirth: Date; }
And the repository:
public async findAll(): Promise<void> { const queryBuilder: SelectQueryBuilder<TypeOrmWorker> = this.createQueryBuilder('worker'); const paginator: Paginator<TypeOrmWorker> = buildPaginator<TypeOrmWorker>({ entity: TypeOrmWorker, paginationKeys: ['id'], query: { limit: 10, order: Order.ASC, }, }); const { data, cursor } = await paginator.paginate(queryBuilder.clone()); console.log('data', data); console.log('cursor', cursor); }
Any idea why I'm getting this error?
Thank you so much.
This is not a paginator issue, please try
const queryBuilder: SelectQueryBuilder<TypeOrmWorker> = this.createQueryBuilder(TypeOrmWorker, 'worker');
Hi,
I'm getting the following error when I try to implement pagination for one of my TypeORM entities:
QueryFailedError: missing FROM-clause entry for table "typeormworker"
And the repository:
Any idea why I'm getting this error?
Thank you so much.