Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When i use Propagation.NESTED, serializable not work #47

Open
GuihaiHU opened this issue Apr 7, 2020 · 1 comment
Open

When i use Propagation.NESTED, serializable not work #47

GuihaiHU opened this issue Apr 7, 2020 · 1 comment

Comments

@GuihaiHU
Copy link

GuihaiHU commented Apr 7, 2020

I write a method A with transaction SERIALIZABLE in my code, and it works as my expect. However, When I add another method B with transaction Propagation.NESTED, and A calls B. I found the transaction A not work like SERIALIZABLE.
This is my code.

 @Transactional({ isolationLevel: IsolationLevel.SERIALIZABLE })
  async addUserScoreAuto(user: AuthUser) {
    await this.service.findOrCreate({ userId: user.id });
  }
 @Transactional({ propagation: Propagation.NESTED })
  async findOrCreate(info: DeepPartial<T>): Promise<[T, boolean]> {
    const entity = await this.repo.findOne(info);
    if (!entity) {
      return [await this.repo.save(info), true];
    }
    return [entity, false];
  }
@xfishernet
Copy link

any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants