How to read changed values with native query during one transaction? (Spring and JPA)
Posted
by knarf1983
on Stack Overflow
See other posts from Stack Overflow
or by knarf1983
Published on 2010-06-15T19:48:59Z
Indexed on
2010/06/16
6:42 UTC
Read the original article
Hit count: 194
We have container transaction with Spring and JPA (Hibernate). I need to make an update on a table to "flag" some rows via native statements. Then we insert some rows via EntityManager from JPATemplate to this table. After that, we need to calculate changes in the table via native statement (with Oracle's union and minus, complex groups...)
I see that changes from step 1 and 2 are not commited and thats why the statement from 3 fails. I already tried with transaction propagation REQUIRES_NEW, EntityManager.flush... Didn't work.
1) update SOMETABLE acolumn = somevalue (native)
2) persist some values into SOMETABLE (via entity manager)
3) select values from SOMETABLE
Is there a possibility to read the changes from step 1 and 2 in step 3?
© Stack Overflow or respective owner