Hibernate version: 3.2.2
Name and version of the database you are using: Postgres 8.2.4
I have a persistent versioned entity loaded in hibernate session A. I make a change to this entity in hibernate session B. I can see that the version number of this entity has been incremented after the update in session B. I reload the entity (via a HQL query.list()) in hibernate session A, but it obviously is pulling the entity out of the cache, as the changed data is not represented. My cache mode is set to NORMAL.
Question one:
I guess I assumed that the reload of the entity in session A would pick up the changes made in session B, because of the version change. Clearly Im wrong and do not understand what specifically occurring in this case. Can someone explain why I wouldnt pick up the changes to the versioned entity in this case?
Question two:
How can I achieve the desired behavior and still realize the maximum performance optimizations afforded by the cache? I dont want to have to reload all the objects returned by the query, only the ones that have been updated.
Thanks
[EDIT]
BTW, the two sessions in the example above are constructed by two different session factories.
Also, I tried setting the CacheMode to REFRESH for the second query, but the results still did not reflect the changes in the DB. I have to clear the session to get the data to reload. I must be missing something here.
|