spring-projects / spring-projects/spring-data-jpa

Transaction marked as rollback only when initialising application when working with transaction manager [DATAJPA-1686]

Open
#1,983 6 comments 0 reactions 1 assignee View on GitHub

@schauder is already working on this.

Since Dec 30, 2020.

in: core type: bug
Dominant language
Java
Stars
3.3k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

mirackle-spb opened DATAJPA-1686 and commented

Looks like DATAJPA-617  is not completely resolved. My app doing some data work while context initialisation is in progress. Inserting default data to database. When it initialising it depends on JpaReposiotory. When spring tries to initialise Repository spring-data-jpa make check for existence of named queries.

Within NamedQuery.javaa when lookupEm.createNamedQuery is called. Later Hibernate in AbstractSharedSessionContract query is not found and exceprion is fired. Hibernate ExceptionConverterImpl fire markForRollbackOnly.

Spring-data catches this exception but it is not matter at this point. Transaction is already marked.

Problem reproduced in 100% of cases when JTA transaction manager is in use


Affects: 2.2.4 (Moore SR4)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.