Hibernate LoadContexts:122 - HHH000100:故障安全清理(集合)

时间:2016-02-15 17:35:22

标签: java hibernate

最近我在Hibernate中遇到了一个相当“怪异”(缺乏更好的词)的问题。当试图坚持我的实体时,会抛出以下WARN / ERROR:

WARN [quartzScheduler_Worker-2]         LoadContexts:122  - HHH000100: Fail-safe cleanup (collections) : org.hibernate.engine.loading.internal.CollectionLoadContext@4bf3ab85<rs=oracle.jdbc.driver.OracleResultSetImpl@1786369e>

WARN [quartzScheduler_Worker-2] CollectionLoadContext:351  - HHH000160: On CollectionLoadContext#cleanup, localLoadingCollectionKeys contained [1] entries

ERROR [quartzScheduler_Worker-2] AbstractArticleImportJob:288  - Failed to update article. 
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [be.persgroep.red.mow.config.entities.hibernate.content.ArticleBlock#2349544]

在下面发布堆栈跟踪的其余部分:

org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [be.persgroep.red.mow.config.entities.hibernate.content.ArticleBlock#2349544]
at org.hibernate.internal.SessionFactoryImpl$1$1.handleEntityNotFound(SessionFactoryImpl.java:244) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:212) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:262) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:150) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1098) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1025) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:671) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.type.EntityType.resolve(EntityType.java:489) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:168) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:137) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1108) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.loader.Loader.processResultSet(Loader.java:964) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.loader.Loader.doQuery(Loader.java:911) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:342) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:312) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.loader.Loader.loadCollection(Loader.java:2238) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:65) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:674) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:85) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:1855) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.collection.internal.AbstractPersistentCollection$4.doWork(AbstractPersistentCollection.java:549) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:234) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:545) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:124) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.collection.internal.PersistentSet.iterator(PersistentSet.java:180) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.type.CollectionType.getElementsIterator(CollectionType.java:246) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.type.CollectionType.getElementsIterator(CollectionType.java:236) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.spi.CascadingAction.getAllElementsIterator(CascadingAction.java:452) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.spi.CascadingAction.access$100(CascadingAction.java:52) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.spi.CascadingAction$7.getCascadableChildrenIterator(CascadingAction.java:320) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:427) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:369) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:345) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:208) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:165) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:449) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultPersistEventListener.justCascade(DefaultPersistEventListener.java:191) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsPersistent(DefaultPersistEventListener.java:183) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:147) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:843) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:836) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.spi.CascadingAction$7.cascade(CascadingAction.java:315) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:399) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:342) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:208) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:429) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:369) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:345) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:208) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:165) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:449) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultPersistEventListener.justCascade(DefaultPersistEventListener.java:191) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsPersistent(DefaultPersistEventListener.java:183) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:147) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:843) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:836) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.spi.CascadingAction$7.cascade(CascadingAction.java:315) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:399) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:342) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:208) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:165) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:424) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultPersistEventListener.justCascade(DefaultPersistEventListener.java:190) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsPersistent(DefaultPersistEventListener.java:183) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:147) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:78) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:853) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:827) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:831) ~[hibernate-core-4.2.7.SP1.jar:4.2.7.SP1]
at be.persgroep.red.mow.config.dao.hibernate.BaseDaoImpl.persist(BaseDaoImpl.java:59) ~[config-3.11.jar:na]
at be.persgroep.red.mow.config.dao.hibernate.BaseDaoImpl.persist(BaseDaoImpl.java:25) ~[config-3.11.jar:na]
at sun.reflect.GeneratedMethodAccessor289.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_25]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_25]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) ~[spring-tx-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) ~[spring-tx-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) ~[spring-tx-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at com.sun.proxy.$Proxy66.persist(Unknown Source) ~[na:na]
at be.persgroep.red.mow.jobs.facade.ImportArticleFacadeImpl.createOrUpdateArticle(ImportArticleFacadeImpl.java:62) ~[classes:na]
at sun.reflect.GeneratedMethodAccessor352.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_25]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_25]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) ~[spring-tx-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) ~[spring-tx-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) ~[spring-tx-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at com.sun.proxy.$Proxy96.createOrUpdateArticle(Unknown Source) ~[na:na]
at be.persgroep.red.mow.jobs.qrtzjobs.article.AbstractArticleImportJob.createOrUpdateArticle(AbstractArticleImportJob.java:277) [classes:na]
at be.persgroep.red.mow.jobs.qrtzjobs.article.AbstractArticleImportJob.createOrUpdateArticleAndRelatedData(AbstractArticleImportJob.java:178) [classes:na]
at be.persgroep.red.mow.jobs.qrtzjobs.article.AbstractArticleImportJob.handleUpdateFeed(AbstractArticleImportJob.java:148) [classes:na]
at be.persgroep.red.mow.jobs.qrtzjobs.article.AbstractArticleImportJob.handleArticleUpdates(AbstractArticleImportJob.java:126) [classes:na]
at be.persgroep.red.mow.jobs.qrtzjobs.article.AbstractArticleImportJob.doExecute(AbstractArticleImportJob.java:113) [classes:na]
at be.persgroep.red.mow.jobs.qrtzjobs.AbstractImportJob.execute(AbstractImportJob.java:41) ~[classes:na]
at be.persgroep.red.mow.jobs.qrtzjobs.AbstractMowQuartzJob.executeInternal(AbstractMowQuartzJob.java:26) ~[classes:na]
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113) ~[spring-context-support-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[quartz-2.2.1.jar:na]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) ~[quartz-2.2.1.jar:na]

说实话,我对错误感到困惑。这是一个相当庞大的应用程序,我不知道这样的错误是如何发挥作用的。我的猜测是Hibernate在某种程度上感觉需要触发Collection清理,并且这会在以后尝试持久化实体时导致问题。然而,故障安全清理警告应该是一个错误,在Hibernate 3.2.5中修复(参见https://hibernate.atlassian.net/browse/HHH-2936)。我的项目中使用的Hibernate版本是4.2.7,因此不应该是问题。到目前为止,我在这个问题上找不到很少的信息,因此我的问题。 你们有什么建议在我的代码中寻找什么可能最终触发这个?

非常感谢!

0 个答案:

没有答案