[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3527) Null Version Comparator for versioned class due to reuse of Second Level CacheDataDescriptionImpl

Justin Patrin (JIRA) noreply at atlassian.com
Tue Nov 30 14:14:13 EST 2010


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

Justin Patrin commented on HHH-3527:
------------------------------------

My apologies, 3.3.1 and 3.3.2 do have this issue. Hibernate-entitymanager 3.3.2 (and 1) were pulling in hibernate 3.2.6, which does not have this issue. It appears that isPuttable is never being called for my entities with the @Version columns with 3.2.6, which makes this problem never happen.

> Null Version Comparator for versioned class due to reuse of Second Level CacheDataDescriptionImpl
> -------------------------------------------------------------------------------------------------
>
>                 Key: HHH-3527
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3527
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: caching (L2)
>    Affects Versions: 3.3.1
>         Environment: 3.3.1 GA, Postgres 8.3.3, EH Cache
>            Reporter: Paul FitzPatrick
>            Priority: Minor
>
> When the SessionFactoryImpl constructor builds the EntityPersister for classes, it consults a cache of entityAccessStrategies for all the known second level cache regions. If only some of the classes in that region have version tags, then it is possible the cached EntityRegionAccessStrategy will be created without a Version Comparator. Subsequent calls to load an object using a Criteria query failed with a NullPointerException (stack trace below). The line being executed is "return version!=null && comparator.compare(version, newVersion) < 0;" and in this case "version" is an Integer object and comparator is null.
> Not sure the appropriate solution. It would seem from an examination of the code that if the EntityRegionAccessStrategy is to be shared, then all classes in the second level cache region _must_ either all have a  "version" column or all have no "version" column. Further, it seems implied that if they use a "version" column, then they must all use the exact same data type. If this is the case, then a better error check on the configuration data may be in order.
> Caused by: java.lang.NullPointerException
>         at org.hibernate.cache.ReadWriteCache$Item.isPuttable(ReadWriteCache.java:426)
>         at org.hibernate.cache.ReadWriteCache.put(ReadWriteCache.java:180)
>         at org.hibernate.cache.impl.bridge.EntityAccessStrategyAdapter.putFromLoad(EntityAccessStrategyAdapter.java:68)
>         at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:179)
>         at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
>         at org.hibernate.loader.Loader.doQuery(Loader.java:752)
>         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
>         at org.hibernate.loader.Loader.doList(Loader.java:2228)
>         at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
>         at org.hibernate.loader.Loader.list(Loader.java:2120)
>         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)

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