Quarkus: Entity not committed when expected

Created on 12 Feb 2020  路  6Comments  路  Source: quarkusio/quarkus

During the execution of a process I open two transactions:

  • One to create an object and inform that the process has started;
  • Another to change the object that was created in the first transaction, informing that the process was completed;

However, after executing the second transaction method, if I query the database the value has not yet been updated. What I expected is that after the execution of the method with the @Transactional annotation is finished, the object is already committed to the database.

The reproduction of the situation is in the project:
https://github.com/emersonl91/quarkus-test

Important lines:
https://github.com/emersonl91/quarkus-tests/blob/master/code-with-quarkus/src/main/java/org/acme/MyService.java#L32

https://github.com/emersonl91/quarkus-tests/blob/master/code-with-quarkus/src/test/java/org/acme/ExampleResourceTest.java#L37


Edit 1:

  • I tested the UserTransaction and TransactionManager classes, but the same problem also occurs.
  • Added the @Transaction annotation to the method that makes the calls, the whole process starts to be executed in a single transaction, which is different from what I expect.

Edit 2:

  • In the transactionTest method I added the @Transactional(NOT_SUPPORTED) annotation, in the persist and update methods I added the @Transactional(REQUIRES_NEW) annotation. The result did not change.

Edit 3:

  • I did a test via POSTMAN and with MSSQL database. I followed the request in the database, the entity is updated as expected, but in the application I use the command MyEntity.findAll().list().get(0) and the entity remains not updated.
kinquestion triagduplicate

Most helpful comment

Should we close this issue as duplicate and focus on #7102? Looks like #7188 is also related

@gastaldi if I understood @FroMage correctly, #7188 is a different issue, as discussed in #7102 thread.

All 6 comments

@zeljkot Yes, it looks very similar to me.

Should we close this issue as duplicate and focus on #7102? Looks like #7188 is also related

@gastaldi i agree

@emersonl91 thanks! Closing as duplicate of #7102

Should we close this issue as duplicate and focus on #7102? Looks like #7188 is also related

@gastaldi if I understood @FroMage correctly, #7188 is a different issue, as discussed in #7102 thread.

Was this page helpful?
0 / 5 - 0 ratings