[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3478) @NaturalId queries not flushed from cache using EntityManager.remove(); exception results from query

Elias Ross (JIRA) noreply at atlassian.com
Fri Sep 12 15:36:04 EDT 2008


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

Elias Ross commented on HHH-3478:
---------------------------------

Application Log:
2008-09-12 12:22:16,921 INFO  [RegionFactoryCacheProviderBridge] Cache provider: org.hibernate.cache.HashtableCacheProvider
2008-09-12 12:22:17,390 INFO  [UpdateTimestampsCache] starting update timestamps cache at region: org.hibernate.cache.UpdateTimestampsCache
2008-09-12 12:22:17,390 INFO  [StandardQueryCache] starting query cache at region: org.hibernate.cache.StandardQueryCache
2008-09-12 12:22:17,718 DEBUG [UpdateTimestampsCache] Pre-invalidating space [Dummy]
Hibernate: insert into Dummy (id, name) values (null, ?)
Hibernate: call identity()
2008-09-12 12:22:17,750 DEBUG [StandardQueryCache] checking cached query results in region: org.hibernate.cache.StandardQueryCache
2008-09-12 12:22:17,750 DEBUG [StandardQueryCache] query results were not found in cache
Hibernate: select this_.id as id14_0_, this_.name as name14_0_ from Dummy this_ where (this_.name=?)
2008-09-12 12:22:17,765 DEBUG [StandardQueryCache] caching query results in region: org.hibernate.cache.StandardQueryCache; timestamp=5002229094846464
2008-09-12 12:22:17,781 DEBUG [UpdateTimestampsCache] Pre-invalidating space [Dummy]
Hibernate: delete from Dummy where id=?
2008-09-12 12:22:17,781 DEBUG [StandardQueryCache] checking cached query results in region: org.hibernate.cache.StandardQueryCache
2008-09-12 12:22:17,781 DEBUG [StandardQueryCache] returning cached query results
2008-09-12 12:22:17,781 DEBUG [TransactionalCache] cache lookup: com.autodesk.lbs.cs.Dummy#1
2008-09-12 12:22:17,781 DEBUG [TransactionalCache] cache miss
Hibernate: select dummy0_.id as id14_0_, dummy0_.name as name14_0_ from Dummy dummy0_ where dummy0_.id=?
2008-09-12 12:22:17,796 DEBUG [UpdateTimestampsCache] Invalidating space [Dummy], timestamp: 5002229095612416
2008-09-12 12:22:17,796 DEBUG [UpdateTimestampsCache] Invalidating space [Dummy], timestamp: 5002229095612417


> @NaturalId queries not flushed from cache using EntityManager.remove(); exception results from query
> ----------------------------------------------------------------------------------------------------
>
>                 Key: HHH-3478
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3478
>             Project: Hibernate Core
>          Issue Type: Bug
>    Affects Versions: 3.3.0.SP1
>         Environment: Java 1.5, Maven dependencies:
> [INFO] (root)
> [INFO] |  \- org.hibernate:hibernate-validator:jar:3.1.0.GA:compile
> [INFO] +- commons-codec:commons-codec:jar:1.3:compile
> [INFO] +- javax.persistence:persistence-api:jar:1.0:compile
> [INFO] +- org.hibernate:hibernate-core:jar:3.3.0.SP1:compile
> [INFO] |  +- antlr:antlr:jar:2.7.6:compile
> [INFO] |  +- commons-collections:commons-collections:jar:3.1:compile
> [INFO] |  \- dom4j:dom4j:jar:1.6.1:compile
> [INFO] |     \- xml-apis:xml-apis:jar:1.0.b2:compile
> [INFO] +- org.hibernate:hibernate-annotations:jar:3.4.0.GA:compile
> [INFO] |  \- org.hibernate:ejb3-persistence:jar:1.0.2.GA:compile
> [INFO] +- org.hibernate:hibernate-commons-annotations:jar:3.3.0.ga:compile
> [INFO] |  \- org.hibernate:hibernate:jar:3.2.1.ga:compile
> [INFO] |     +- net.sf.ehcache:ehcache:jar:1.2.3:compile
> [INFO] |     +- asm:asm-attrs:jar:1.5.3:compile
> [INFO] |     +- cglib:cglib:jar:2.1_3:compile
> [INFO] |     \- asm:asm:jar:1.5.3:compile
> [INFO] +- org.hibernate:hibernate-entitymanager:jar:3.4.0.GA:compile
> [INFO] |  \- javassist:javassist:jar:3.4.GA:compile
> [INFO] +- javax.transaction:jta:jar:1.0.1B:compile
> [INFO] +- org.slf4j:slf4j-api:jar:1.5.2:compile
> [INFO] +- org.slf4j:slf4j-log4j12:jar:1.5.2:compile
> [INFO] +- hsqldb:hsqldb:jar:1.8.0.10:test
> [INFO] \- junit:junit:jar:4.4:test
>            Reporter: Elias Ross
>         Attachments: Dummy.java, DummyTest.java, persistence.xml
>
>
> See attached test case and entity.
> Current Result:
> javax.persistence.EntityNotFoundException: Unable to find com.autodesk.lbs.cs.Dummy with id 1
> 	at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:113)
> 	at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:171)
> 	at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:223)
> 	at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126)
> 	at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
> 	at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:873)
> 	at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:590)
> 	at org.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:219)
> 	at org.hibernate.cache.StandardQueryCache.get(StandardQueryCache.java:155)
> 	at org.hibernate.loader.Loader.getResultFromQueryCache(Loader.java:2184)
> 	at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2147)
> 	at org.hibernate.loader.Loader.list(Loader.java:2117)
> 	at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
> 	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596)
> 	at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
> 	at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:328)
> 	at com.autodesk.lbs.cs.DummyTest.naturalKeyCachedQuery(DummyTest.java:69)
> 	at com.autodesk.lbs.cs.DummyTest.naturalKeyCachedQuery(DummyTest.java:61)
> 	at com.autodesk.lbs.cs.DummyTest.testQuery(DummyTest.java:49)
> It's expected that a cache invalidation occurs with an entity's natural key when it is removed.
> I'll investigate a solution.

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