dirty data be inserted into 2L cache
-------------------------------------
Key: HHH-5490
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5490
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.5.5, 3.6.0.Beta3
Reporter: Strong Liu
Attachments: Item.java, ItemTest.java
{code}
public void testInsertWithRefresh() {
getSessions().getCache().evictEntityRegions();
getSessions().getStatistics().clear();
Session s = openSession();
s.beginTransaction();
Item item = new Item();
item.setName("stliu");
s.save(item);
s.flush();
s.refresh(item);
s.getTransaction().rollback();
s.close();
Map cacheMap = getSessions().getStatistics()
.getSecondLevelCacheStatistics("item").getEntries();
assertEquals(0, cacheMap.size());
s = openSession();
s.beginTransaction();
item = (Item)s.get(Item.class, item.getId());
s.getTransaction().commit();
s.close();
assertNull("it should be null", item);
}
{code}
see above test case, since the insertion is rollbacked, so, there is no that row in the
DB, but you can see the null assertion will fail due to the dirty data be inserted into
the 2l cache after refresh operation.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: