I'm just writing to clarify the basic behavior of the second-level cache.
If I understand the second-level cache correctly, I should get the same *exact* object back from the cache, not just an object that satisfies an equality test with .equals().
Thus in the following example, if DomesticCat is configured for caching, this test case should succeed, right?
// Save cat
DomesticCat cat = new DomesticCat();
Long id= (Long) sess1.save(fritz);
// Load in new session
DomesticCat foundCat = (DomesticCat) sess2.load(cat.getClass(), id);
// Assert sameness
assertSame(cat, foundCat);
|