Skip to content

Doc: Flush in test with SessionFactory vs EntityManager [SPR-13723] #18296

@spring-projects-issues

Description

@spring-projects-issues

Viktor Kostov opened SPR-13723 and commented

According to a documentation (http://docs.spring.io/spring/docs/current/spring-framework-reference/html/integration-testing.html#testcontext-tx-enabling-transactions), should be possible to flush current session to avoid false positive in a test. Not sure about root cause of the problem, but it seems that sessionFactory.getCurrentSession().flush(); creates new transaction, instead of using existing one.

Here is a small sample that demonstrates a problem: https://github.com/sk8ter/demo

Test should fail in an example of project above.


Affects: 4.2.3

Reference URL: http://stackoverflow.com/questions/33905773/spring-boot-test-test-passes-but-should-not-false-positive

Issue Links:

Referenced from: commits 17df02d

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)in: webIssues in web modules (web, webmvc, webflux, websocket)type: taskA general task

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions