How to read changed values with native query during one transaction? (Spring and JPA) -
We have container transactions with Spring and JPA (hibernate). I have to update some rows on a table for "flags" through native details. Then we insert some lines from JPetimplate through EntityManager in this table. After that, we need to calculate the changes in the table through the original statement (with the association of Oracle and zero, with complex groups) ...
I think in steps 1 and 2 The changes have not been made and that is why the statement fails from 3. I was already trying with transaction promotion REQUIRES_NEW, EntityManager.flush ... did not work.
1) Some exchanges = some value updates (original) 2)) 3) Select values from SOMETABLE
What steps Phase 1 and 2 There is a possibility to read changes in 3?
I think you can write DataSource
to JpaTransactionManager
, JdbcTemplate
and JpaTemplate
and with this it has enabled @transactional
:
& lt; Tx: annotation-driven / & gt;
Believing it is not a configuration bug, my best estimate is that you are calling the method in the same class by a method using the @transaction
method Are you
In that case, you need to factor in the transaction logic or weaving in the reactor code, so the @transaction
method is in the second class from the calling method. (Refactor option is one easy and preferred)
If it does not solve your problem, then you should add relevant class with related questions related to the questions.
Comments
Post a Comment