问题描述
插入新记录后,我意识到对象中的所有公式属性都为空。
这是一个实体:
@Entity()
export class Book extends BaseEntity {
@property()
title: string;
@property()
width: number;
@property()
height: number;
@Formula('width * height')
area?: number;
constructor(title: string,width: number,height: number) {
this.title = title;
this.width = width;
this.height = height;
}
}
我现在正在做的是在用 findOne
刷新后立即按 id 生成 refresh: true
。
const book = new Book('test',15,20);
em.persist(book);
await em.flush();
await em.findOne({ id: book.id },{ refresh: true });
我在文档中找不到任何对此的引用。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)