You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you attempt to load a non-singleton Entity which does not exist, an EntityNotFoundError is thrown:
@Entity({ datastore })classComplexEntity{
@Column({isPrimary: true})publicid: stringconstructor(id: string){this.id=id}}constcomplexRepository=getRepository(ComplexEntity)constcomplexInstance=newComplexEntity('12345')awaitcomplexRepository.save(complexInstance)awaitcomplexRepository.load('12345')// returns a new ComplexEntity instanceawaitcomplexRepository.load('99999')// throws EntityNotFoundError
This behaviour is not found with singleton Entities:
@Entity({ datastore })classSingletonEntity{// ...}constsingletonRepository=getRepository(SingletonEntity)constsingletonInstance=newSingletonEntity()awaitsingletonRepository.load()// returns a new SingletonEntity instance <--awaitsingletonRepository.save(singletonInstance)awaitsingletonRepository.load()// returns a new SingletonEntity instance
Should the indicated line (<--) throw an EntityNotFoundError? If so, why? If not, why not?
The text was updated successfully, but these errors were encountered:
If you attempt to load a non-singleton Entity which does not exist, an
EntityNotFoundError
is thrown:This behaviour is not found with singleton Entities:
Should the indicated line (
<--
) throw an EntityNotFoundError? If so, why? If not, why not?The text was updated successfully, but these errors were encountered: