I am facing a very interesting problem. After updating an entity through EntityManager API, I update the data through a stored proc via a jdbc connection object. both the updates - done by em and stored proc are reflected in database. Then in another call to em.find() is made but that does not reflect the changes done by stored proc.
the code flow looks like the following...
..//do some changes in entity
callToStoredProc(); // this method invokes stored proc via connection object obtained from datasource and does updates
And then from within another session bean I call em.find() which does gives me back the data updated through stored proc.
Thanks for showing interest in this problem. I am not sure about isolation level and code is not available right now, so can't look into.
Please let me know in this situation what should be the isolation level set to for data-source connections and for Entitymanager settings? your inputs please...
Also, please note that we are using container managed transaction here and we have NOT declared any transaction attribute on the method callToStoredProc(). I believe though the method callToStoredProc() executes in the propagated transaction, the updates done using connection object are NOT going to be in the same transaction. Please correct me if I am wrong.
We are using Hibernate's JPA provider. Though we were able to get around the problem by getting access to hibernate session factory and then evicting the entity. But here the use of Hibernate's proprietary API is not being accepted and they want me to use only standard JPA APIs to fix it (In order to have no dependency on underlying JPA provider).
Your input are welcome.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Data updated through stored proc is not retrieved by subsequent em.find() calls