I am trying to register and migrate a new entity (Nest.js) but it fails with the following error text:
ERROR [ExceptionHandler] No repository for "Product" was found. Looks like this entity is not registered in the current "default" connection?
product.entity.ts
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm"; @Entity() export class Product { @PrimaryGeneratedColumn() id: number; @Column() title: string; @Column() image: string; }
product.module.ts
import { Module } from '@nestjs/common'; import { ProductController } from './product.controller'; import { TypeOrmModule } from "@nestjs/typeorm"; import { Product } from "./product.entity"; @Module({ imports: [ TypeOrmModule.forFeature([Product]) ], controllers: [ProductController] }) export class ProductModule {}
Any ideas?
Advertisement
Answer
You could use the auto load entities feature to circumvent that. (like I said on discord)