[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5490) dirty data be inserted into 2L cache

Strong Liu (JIRA) noreply at atlassian.com
Thu Aug 19 06:08:41 EDT 2010


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.6.0.Beta3, 3.5.5
            Reporter: Strong Liu


{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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list