I'm seeing the following unexpected behavior:
Class "Test" is declared with <cache usage="read-write" /> and 2nd level cache is enabled and query cache is enabled
1. Open session; load Test with ID 1 (NH issues SELECT statement, as expected); Close session
2. Open session; load Test with ID 1 (No database trip, as expected); Close session
3. Open session, load Test with ID 1 (No database trip, as expected); Change property of Test, Flush session (NH issues UPDATE statement, as expected); Close session
4. Open session; load Test with ID 1 (NH issues SELECT statement!); Close session
My question is why does NH issue another select statement in step 4? The updated object should still be in the level 2 cache, correct? I dont understand why issuing an UPDATE statement seems to evict the object from the cache. Any ideas appreciated. Thanks
|