Org.hibernate.assertionfailure:collection[...] is not processed by flush ()

Source: Internet
Author: User

August 11:00:49 am org.apache.catalina.core.StandardWrapperValve Invoke severity: Servlet.service () for  servlet [Zyg] in the context with path [] threw exception [Request processing failed; nested exception is Org.springfram Ework.transaction.TransactionSystemException:Could not commit JPA transaction; Nested exception is Javax.persistence.RollbackException:Error   while  committing the transaction] with root causeorg.hibernate.AssertionFailure: Collection [ Com.iskyshop.foundation.domain.Accessory.goods_list] was wasn't processed by flush ()  at Org.hibernate.engine.CollectionEntry.postFlush (Collectionentry.java:228) at Org.hibernate.event.def.AbstractFlushingEventListener.postFlush (Abstractflushingeventlistener.java: 65W) at Org.hibernate.event.def.DefaultFlushEventListener.onFlush (Defaultflusheventlistener.java:52) at Org.hibernate.impl.SessionImpl.flush (Sessionimpl.java:1216) at Org.hibernate.impl.SessionImpl.managedFlush (Sessionimpl.java:383) at Org.hibernate.transaction.JDBCTransaction.commit (Jdbctransaction.java:133) at Org.hibernate.ejb.TransactionImpl.commit (Transactionimpl.java:76) at Org.springframework.orm.jpa.JpaTransactionManager.doCommit (Jpatransactionmanager.java:512) at Org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit ( Abstractplatformtransactionmanager.java:754) at Org.springframework.transaction.support.AbstractPlatformTransactionManager.commit ( Abstractplatformtransactionmanager.java:723) at Org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning ( Transactionaspectsupport.java:394) at Org.springframework.transaction.interceptor.TransactionInterceptor.invoke (Transactioninterceptor.java: 120) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 172) at Org.springframework.aop.framework.cglib2aopproxy$dynamicadvisedinterceptor.intercept ( Cglib2aopproxy.java:622) at com.iskyshop.foundation.service.impl.goodsserviceimpl$ $EnhancerByCGLIB $$4f9701b4.update (<generated>) at Com.iskyshop.manage.seller.action.GoodsSellerAction.goods_sale (Goodsselleraction.java:2416) at com.iskyshop.manage.seller.action.goodsselleraction$ $FastClassByCGLIB $ $b 84842ac.invoke (<generated>) at Net.sf.cglib.proxy.MethodProxy.invoke (Methodproxy.java:149) at Org.springframework.aop.framework.cglib2aopproxy$cglibmethodinvocation.invokejoinpoint ( Cglib2aopproxy.java:689) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 150) at Org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke ( Methodbeforeadviceinterceptor.java:50) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 161) at Org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke (Exposeinvocationinterceptor.java :90) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 172) at Org.springframework.aop.framework.cglib2aopproxy$dynamicadvisedinterceptor.intercept ( Cglib2aopproxy.java:622) at com.iskyshop.manage.seller.action.goodsselleraction$ $EnhancerByCGLIB $ $f 765adf.goods_sale (<generated>) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (Unknown source) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown source) at Java.lang.reflect.Method.invo Ke (Unknown Source) at Org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod ( Handlermethodinvoker.java:176) at Org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod ( Annotationmethodhandleradapter.java:436) at Org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle ( Annotationmethodhandleradapter.java:424) at Org.springframework.web.servlet.DispatcherServlet.doDispatch (Dispatcherservlet.java:923) at Org.springframework.web.servlet.DispatcherServlet.doService (Dispatcherservlet.java:852) at Org.springframework.web.servlet.FrameworkServlet.processRequest (Frameworkservlet.java:882) at Org.springframework.web.servlet.FrameworkServlet.doPost (Frameworkservlet.java:789) at Javax.servlet.http.HttpServlet.service (Httpservlet.java:648) at Javax.servlet.http.HttpServlet.service (Httpservlet.java:729) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:292) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:207) at Org.apache.tomcat.websocket.server.WsFilter.doFilter (Wsfilter.java:52) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:240) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:207) at Org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite (Rulechain.java:176) at Org.tuckey.web.filters.urlrewrite.RuleChain.doRules (Rulechain.java:145) at Org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest (Urlrewriter.java:92) at Org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter (Urlrewritefilter.java:394) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:240) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:207) at Com.iskyshop.core.filter.ShopFilter.doFilter (Shopfilter.java:121) at Org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (Delegatingfilterproxy.java:346) at Org.springframework.web.filter.DelegatingFilterProxy.doFilter (Delegatingfilterproxy.java:259) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:240) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:207) at Org.springframework.security.util.filterchainproxy$virtualfilterchain.dofilter (FilterChainProxy.java: 378) at Org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke ( Filtersecurityinterceptor.java:109) at Org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter ( Filtersecurityinterceptor.java:83) at Org.springframework.security.util.filterchainproxy$virtualfilterchain.dofilter (FilterChainProxy.java: 390) at Org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke ( Filtersecurityinterceptor.java:109) at Org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter ( Filtersecurityinterceptor.java:83) at Org.springframework.security.util.filterchainproxy$virtualfilterchain.dofilter (FilterChainProxy.java: 390) at Org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp ( Sessionfixationprotectionfilter.java:67) at Org.springframework.security.ui.SpringSecurityFilter.doFilter (Springsecurityfilter.java:53) at Org.springframework.security.util.filterchainproxy$virtualfilterchain.dofilter (FilterChainProxy.java: 390) at Com.iskyshop.core.security.support.ShopSecurityExceptionFilter.doFilterHttp ( Shopsecurityexceptionfilter.java:77) at Org.springframework.security.ui.SpringSecurityFilter.doFilter (Springsecurityfilter.java:53) at Org.springframework.security.util.filterchainproxy$virtualfilterchain.dofilter (FilterChainProxy.java: 390) at Org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp (Exceptiontranslationfilter.java :101) at Org.springframework.security.ui.SpringSecurityFilter.doFilter (Springsecurityfilter.java:53) at Org.springframework.security.util.filterchainproxy$virtualfilterchain.dofilter (FilterChainProxy.java: 390) at Org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp ( Securitycontextholderawarerequestfilter.java:91) at Org.springframework.security.ui.SpringSecurityFilter.doFilter (Springsecurityfilter.java:53) at Org.springframework.security.util.filterchainproxy$virtualfilterchain.dofilter (FilterChainProxy.java: 390) at Org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp (Abstractprocessingfilter.java: 277) at Org.springframework.security.ui.SpringSecurityFilter.doFilter (Springsecurityfilter.java:53) at Org.springframework.security.util.filterchainproxy$virtualfilterchain.dofilter (FilterChainProxy.java: 390) at Org.springframework.security.ui.logout.LogoutFilter.doFilterHttp (Logoutfilter.java:89) at Com.iskyshop.core.filter.NorLogoutFilter.doFilterHttp (Norlogoutfilter.java:83) at Org.springframework.security.ui.SpringSecurityFilter.doFilter (Springsecurityfilter.java:53) at Org.springframework.security.util.filterchainproxy$virtualfilterchain.dofilter (FilterChainProxy.java: 390) at Org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp ( Httpsessioncontextintegrationfilter.java:235) at Org.springframework.security.ui.SpringSecurityFilter.doFilter (Springsecurityfilter.java:53) at Org.springframework.security.util.filterchainproxy$virtualfilterchain.dofilter (FilterChainProxy.java: 390) at Org.springframework.security.concurrent.ConcurrentSessionFilter.doFilterHttp ( Concurrentsessionfilter.java:99) at Org.springframework.security.ui.SpringSecurityFilter.doFilter (Springsecurityfilter.java:53) at Org.springframework.security.util.filterchainproxy$virtualfilterchain.dofilter (FilterChainProxy.java: 390) at Org.springframework.security.util.FilterChainProxy.doFilter (Filterchainproxy.java:175) at Org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (Delegatingfilterproxy.java:346) at Org.springframework.web.filter.DelegatingFilterProxy.doFilter (Delegatingfilterproxy.java:259) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:240) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:207) at Org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (Characterencodingfilter.java: 88) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:76) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:240) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:207) at Org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal ( Openentitymanagerinviewfilter.java:147) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:76) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:240) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:207) at Org.apache.catalina.core.StandardWrapperValve.invoke (Standardwrappervalve.java:212) at Org.apache.catalina.core.StandardContextValve.invoke (Standardcontextvalve.java:106) at Org.apache.catalina.authenticator.AuthenticatorBase.invoke (Authenticatorbase.java:502) at Org.apache.catalina.core.StandardHostValve.invoke (Standardhostvalve.java:141) at Org.apache.catalina.valves.ErrorReportValve.invoke (Errorreportvalve.java:79) at Org.apache.catalina.valves.AbstractAccessLogValve.invoke (Abstractaccesslogvalve.java:616) at Org.apache.catalina.core.StandardEngineValve.invoke (Standardenginevalve.java:88) at Org.apache.catalina.connector.CoyoteAdapter.service (Coyoteadapter.java:528) at Org.apache.coyote.http11.AbstractHttp11Processor.process (Abstracthttp11processor.java:1099) at Org.apache.coyote.abstractprotocol$abstractconnectionhandler.process (Abstractprotocol.java:672) at Org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun (Nioendpoint.java:1520) at Org.apache.tomcat.util.net.nioendpoint$socketprocessor.run (Nioendpoint.java:1476) at Java.util.concurrent.ThreadPoolExecutor.runWorker (Unknown Source) at Java.util.concurrent.ThreadPoolExecut Or$worker.run (Unknown Source) at Org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run (TaskThread.java: 61) at Java.lang.Thread.run (Unknown Source)

Read the above bug to describe my background for this error.

I have a product category, and a product picture class

Class goods{    @ManeyToManey  
@JoinTable (name = "Goods_photo", Joincolumns = @JoinColumn (name = "goods_id"), Inversejoincolumns = @JoinColumn (name = "ph oto_id ")) private list<accessory> Goods_photos;} Class accessroy{ ..... // Basic data types

@ManyToMany (Mappedby = "Goods_photos")
Private list<goods> goods_list = new arraylist<goods> ();//Product List

}

My business scenario is to save the item to Lucene after the item has been updated. The following code

 for (Goods goods:goodslist) {    = Goodsservice.getobjbyid ();    ...... // some processing     goodsservice.update (goods);      if (goods.status==1) {   // If the status is 1, add           lucene.add (goods);      }    }

I found that if I dug step-by-step, there is no problem, but once I run the program directly, I will report

Collection [Com.iskyshop.foundation.domain.Accessory.goods_list] was wasn't processed by flush ()

Please translate the question directly, Collection. "Did not go through flush processing.

After understanding, the problem may be found in hibernate cache. Since we have used many pairs of pairs (or many to one), the corresponding accessory has not been refreshed immediately after we have updated the goods several times.

-----------------------------------------------------------------------------

As of August 12, 2016, I have not found a solution. If anyone has ever met, please give us more advice. If I fix it, I'll keep updating it.

Org.hibernate.assertionfailure:collection[...] is not processed by flush ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.