admin管理员组文章数量:1353331
I create a Nest project with many generic entities. I have two abstract classes :
@Entity()
export abstract class GenericEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column()
name: string;
@OneToMany(() => AdditionalField, field => field.entity, {
eager: true,
cascade: true
})
additionalFields: AdditionalField[];
}
@Entity()
export abstract class AdditionalField {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column()
name: string;
@ManyToOne(() => GenericEntity, entity => entity.additionalFields)
@JoinColumn()
entity: GenericEntity;
}
The problem is that implementation does not work. If I extends my classes, the child classes have foreign keys of generic entities and that cause 500 error at execution. What is the best way to do that? (I have many different type of additionalFields, and many different type of generic Entities).
本文标签: typescriptHow to use TypeORM with generic typesStack Overflow
版权声明:本文标题:typescript - How to use TypeORM with generic types? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743924003a2562620.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论