|
Hi,
I am running a couple of test from jBPM. I am using application managed transactions so before the start of the transaction I do lookup through JNDI and then I call begin(), I do what I want and then I call commit()/rollback(). And here is the thing: I noticed that when I insert some data into the DB and then in the same transaction I execute a query which obtains previously inserted data, I do not get this data. However when I do commit() and then I query the inserted data, the data are obtained. So I thought that FlushMode AUTO may be the issue so I changed it in persistence.xml to <property name="org.hibernate.flushMode" value="ALWAYS" />. Then I checked if it is properly set by calling em.unwrap(Session.class).getFlushMode() - it is set to ALWAYS as I want. But it behaves the same. It must be said that it happens if and only if I am using Oracle DB, no matter which version, but I tried it mostly with Oracle 12c. When I try it with MySQL or MS SQL for instance, I notice that right before the query to obtain data is going to be executed, Hibernate sends SQL Inserts/Updates to DB so the following query will query them. With Oracle the inserts/updates are sent only after the commit is performed. It is like that regardless the container (JBoss EAP/WLS/WAS). Thanks.
Marian
|