在这种情况下,商店可以有许多所有者,所有者可以有许多商店。
但是,当我使用存储库保存实体并发生问题时:
超出了最大通话堆栈大小
我认为需要使用嵌套树注释吗?但是我不知道如何纠正它。请帮忙!
@Entity('store')
export class StoreEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column()
name: string;
...
@ManyToMany(type => UserEntity, user => user.ownStores)
@JoinTable()
owners: UserEntity[];
}
@Entity('user')
export class UserEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({
type: 'varchar',
})
email: string;
...
@ManyToMany(type => StoreEntity, store => store.owners)
ownStores: StoreEntity[];