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

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


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5490?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Strong Liu updated HHH-5490:
----------------------------

    Attachment: ItemTest.java
                Item.java

test case attached

> 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: 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