-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
questionFurther information is requestedFurther information is requested
Description
If you attempt to load a non-singleton Entity which does not exist, an EntityNotFoundError is thrown:
@Entity({ datastore })
class ComplexEntity {
@Column({ isPrimary: true })
public id: string
constructor(id: string) {
this.id = id
}
}
const complexRepository = getRepository(ComplexEntity)
const complexInstance = new ComplexEntity('12345')
await complexRepository.save(complexInstance)
await complexRepository.load('12345') // returns a new ComplexEntity instance
await complexRepository.load('99999') // throws EntityNotFoundErrorThis behaviour is not found with singleton Entities:
@Entity({ datastore })
class SingletonEntity {
// ...
}
const singletonRepository = getRepository(SingletonEntity)
const singletonInstance = new SingletonEntity()
await singletonRepository.load() // returns a new SingletonEntity instance <--
await singletonRepository.save(singletonInstance)
await singletonRepository.load() // returns a new SingletonEntity instanceShould the indicated line (<--) throw an EntityNotFoundError? If so, why? If not, why not?
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested