[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2316) org.hibernate.cache.CacheKey.equals() can cause PropertyAccessException to be thrown

Joel Caplin (JIRA) noreply at atlassian.com
Wed May 9 12:20:04 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_26893 ] 

Joel Caplin commented on HHH-2316:
----------------------------------

Sorry - it's been a long time since I looked at this so I'll take baby steps:

- We have an entity "LocalKey"

- Lots of other entities in our model contain associated sets of these local keys

- The set collection in the other entities is constrained by a where clause (which is usually something like "where local_key_type='ENTITY_NAME')

- We cache LocalKey instances themselves in a region called "LocalKeys". So in our LocalKey.hbm.xml we have a <cache usage="read-only" region="LocalKeys"> type expression underneath the <class> element

- We cache the set associations (i.e. Entity1 -|--<- LocalKey, Entity2 -|--<- LocalKey) in the same region. So in our XXXEntity.hbm.xml we have a similar cache expression as above, except underneath the <set>  element

So I suppose that yes, we are pushing cached data from separate entities (the LocalKeys themselves *and* the associations) into the same cache region.


HTH 
Joel



> org.hibernate.cache.CacheKey.equals() can cause PropertyAccessException to be thrown
> ------------------------------------------------------------------------------------
>
>                 Key: HHH-2316
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2316
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.1
>         Environment: Windows XP / Sybase 12.5 / Java 1.5.0_09 / ehcache 1.2.4
>            Reporter: Joel Caplin
>            Assignee: Steve Ebersole
>         Attachments: cacheTest.zip
>
>
> org.hibernate.cache.CacheKey.equals() uses lazy evaluation in its return clause: it first calls type.isEqual() and, if true, then calls entityOrRoleName.equals().
> I am having difficulty reproducing this bug in the form of a test case owing to the complexity of our model and the large amount of data in question-- however, in certain circumstances, where the entityOrRoleName's are NOT equal, calling type.isEqual() yields a PropertyAccessException.
> When this bug manifests itself (a PropertyAccessException is thrown), it causes ALL future Hibernate requests to throw a similar exception, thus rendering our service unusable.
> This is fixed when the lazy evaluation is done the other way around: call entityOrRoleName.equals() prior to type.isEqual() - cheap string comparision vs an expensive call which has a large call tree under it.

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