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

Nikita Koksharov (JIRA) noreply at atlassian.com
Mon Oct 25 05:46:47 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=38863#action_38863 ] 

Nikita Koksharov commented on HHH-5490:
---------------------------------------

Testcase will be broken if entity will use Transactional cache strategy!

> 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
>            Assignee: Steve Ebersole
>             Fix For: 3.5.x, 3.6.0.CR2
>
>         Attachments: Item.java, ItemTest.java
>
>          Time Spent: 4.35h
>  Remaining Estimate: 0h
>
> {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