Uploaded image for project: 'Hibernate ORM'
  1. Hibernate ORM
  2. HHH-11173

Bytecode enhanced lazy collection won't load from cache

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 5.2.3
    • Fix Version/s: 5.2.7, 5.1.5
    • Component/s: hibernate-core
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      When loading a bytecode enhanced lazy collection of a cached entity, an exception is thrown:

      java.lang.ClassCastException: org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer$1 cannot be cast to java.util.Collection
      	at org.hibernate.type.CollectionType.getElementsIterator(CollectionType.java:245)
      	at org.hibernate.type.CollectionType.renderLoggableString(CollectionType.java:209)
      	at org.hibernate.type.CollectionType.toLoggableString(CollectionType.java:202)
      	at org.hibernate.type.TypeHelper.toLoggableString(TypeHelper.java:377)
      	at org.hibernate.cache.spi.entry.StandardCacheEntryImpl.<init>(StandardCacheEntryImpl.java:60)
      	at org.hibernate.persister.entity.AbstractEntityPersister$StandardCacheEntryHelper.buildCacheEntry(AbstractEntityPersister.java:5219)
      	at org.hibernate.persister.entity.AbstractEntityPersister.buildCacheEntry(AbstractEntityPersister.java:4230)
      	at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:182)
      	at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:125)
      	at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1146)
      	at org.hibernate.loader.Loader.processResultSet(Loader.java:1005)
      	at org.hibernate.loader.Loader.doQuery(Loader.java:943)
      	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:349)
      	at org.hibernate.loader.Loader.doList(Loader.java:2615)
      	at org.hibernate.loader.Loader.doList(Loader.java:2598)
      	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2430)
      	at org.hibernate.loader.Loader.list(Loader.java:2425)
      	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502)
      	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371)
      	at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
      	at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1460)
      	at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1426)
      	at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1398)
      	at org.hibernate.query.internal.AbstractProducedQuery.getSingleResult(AbstractProducedQuery.java:1444)
      	at org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.getSingleResult(CriteriaQueryTypeQueryAdapter.java:107)
      

        Attachments

          Issue links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: