[hibernate-dev] Collection was not processed by flush()

Emmanuel Bernard emmanuel at hibernate.org
Wed Jun 8 04:37:24 EDT 2016


My modest contribution

https://hibernate.atlassian.net/browse/HHH-10813
https://github.com/hibernate/hibernate-orm/pull/1408

Emmanuel

> On 07 Jun 2016, at 15:25, Steve Ebersole <steve at hibernate.org> wrote:
> 
> I agree that the wording should be changed.  That sentiment is true of many, many exceptions.
> 
> 
> On Tue, Jun 7, 2016 at 8:21 AM Emmanuel Bernard <emmanuel at hibernate.org <mailto:emmanuel at hibernate.org>> wrote:
> We probably should change this message.
> When was the last time this message was due to a bug in our logic?
> I can't remember a time when this was the case personally.
> 
> Thoughts?
> 
> On Sun 2016-06-05 17:17, Petar Tahchiev wrote:
> > Hello,
> >
> > I'm using hibernate version 5.1.0.Final and spring-data-rest and I have a
> > StockRepository which is exposed via rest and when I try to create a new
> > stock entry I get the following exception:
> >
> > 2016-06-05 17:02:43,917 org.hibernate.AssertionFailure
> > [http-nio-127.0.0.1-8112-exec-2] ERROR: HHH000099: an assertion failure
> > occured (this may indicate a bug in Hibernate, but is more likely due to
> > unsafe use of the session): org.hibernate.AssertionFailure: collection [
> > com.nemesis.platform.module.commerce.core.entity.i18n.CurrencyEntity.name <http://com.nemesis.platform.module.commerce.core.entity.i18n.currencyentity.name/>]
> > was not processed by flush()
> > 2016-06-05 17:02:43,920
> > org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/storefront].[repositoryRestDispatcherServlet]
> > [http-nio-127.0.0.1-8112-exec-2] ERROR: Servlet.service() for servlet
> > [repositoryRestDispatcherServlet] in context with path [/storefront] threw
> > exception [Request processing failed; nested exception is
> > org.springframework.transaction.TransactionSystemException: Could not
> > commit JPA transaction; nested exception is
> > javax.persistence.RollbackException: Error while committing the
> > transaction] with root cause
> > org.hibernate.AssertionFailure: collection [
> > com.nemesis.platform.module.commerce.core.entity.i18n.CurrencyEntity.name <http://com.nemesis.platform.module.commerce.core.entity.i18n.currencyentity.name/>]
> > was not processed by flush()
> >     at
> > org.hibernate.engine.spi.CollectionEntry.postFlush(CollectionEntry.java:214)
> >     at
> > org.hibernate.event.internal.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:369)
> >     at
> > org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:40)
> >     at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1295)
> >     at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:468)
> >     at
> > org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3135)
> >     at
> > org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2352)
> >     at
> > org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:485)
> >     at
> > org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:147)
> >     at
> > org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$100(JdbcResourceLocalTransactionCoordinatorImpl.java:38)
> >     at
> > org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:231)
> >     at
> > org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:65)
> >     at
> > org.hibernate.jpa.internal.TransactionImpl.commit(TransactionImpl.java:61)
> >     at
> > org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:517)
> >     at
> > org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761)
> >     at
> > org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730)
> >     at sun.reflect.GeneratedMethodAccessor191.invoke(Unknown Source)
> >     at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >     at java.lang.reflect.Method.invoke(Method.java:498)
> >     at
> > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
> >     at
> > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
> >     at
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
> >     at
> > org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:127)
> >     at
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
> >     at
> > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
> >     at com.sun.proxy.$Proxy349.commit(Unknown Source)
> >     at
> > org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:485)
> >     at
> > org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)
> >     at
> > org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
> >     at
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
> >     at
> > org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
> >     at
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
> >     at
> > org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:131)
> >     at
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
> >     at
> > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
> >     at
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
> >     at
> > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
> >     at com.sun.proxy.$Proxy304.save(Unknown Source)
> >     at
> > org.springframework.data.repository.support.CrudRepositoryInvoker.invokeSave(CrudRepositoryInvoker.java:100)
> >     at
> > org.springframework.data.rest.core.support.UnwrappingRepositoryInvokerFactory$UnwrappingRepositoryInvoker.invokeSave(UnwrappingRepositoryInvokerFactory.java:225)
> >     at
> > org.springframework.data.querydsl.QuerydslRepositoryInvokerAdapter.invokeSave(QuerydslRepositoryInvokerAdapter.java:158)
> >     at
> > org.springframework.data.rest.webmvc.RepositoryEntityController.createAndReturn(RepositoryEntityController.java:514)
> >     at
> > org.springframework.data.rest.webmvc.RepositoryEntityController.postCollectionResource(RepositoryEntityController.java:276)
> >     at sun.reflect.GeneratedMethodAccessor325.invoke(Unknown Source)
> >     at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >     at java.lang.reflect.Method.invoke(Method.java:498)
> >     at
> > org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
> >     at
> > org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
> >     at
> > org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
> >     at
> > org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:832)
> >     at
> > org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:743)
> >     at
> > org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
> >     at
> > org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961)
> >     at
> > org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895)
> >     at
> > org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
> >     at
> > org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)
> >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
> >     at
> > org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
> >     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.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:261)
> >     at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> >     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.CorsFilter.doFilterInternal(CorsFilter.java:92)
> >     at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> >     at
> > org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:115)
> >     at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> >     at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
> >     at
> > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
> >     at
> > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
> >     at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
> >     at
> > org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
> >     at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
> >     at
> > org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
> >     at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
> >     at
> > org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
> >     at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
> >     at
> > org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
> >     at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
> >     at
> > org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
> >     at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
> >     at
> > org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)
> >     at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> >     at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
> >     at
> > com.nemesis.platform.core.filter.RestAuthenticationFilter.doFilterInternal(RestAuthenticationFilter.java:70)
> >     at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> >     at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
> >     at
> > org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
> >     at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
> >     at
> > org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
> >     at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
> >     at
> > org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
> >     at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> >     at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
> >     at
> > org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
> >     at
> > org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
> >     at
> > org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
> >     at
> > org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
> >     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.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87)
> >     at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> >     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.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
> >     at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> >     at
> > com.nemesis.platform.module.cms.storefront.filter.PathLocaleFilter.doFilterInternal(PathLocaleFilter.java:87)
> >     at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> >     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.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
> >     at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> >     at
> > org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:126)
> >     at
> > org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:65)
> >     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.CorsFilter.doFilterInternal(CorsFilter.java:92)
> >     at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> >     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:121)
> >     at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> >     at
> > org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:103)
> >     at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> >     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.valves.RemoteIpValve.invoke(RemoteIpValve.java:676)
> >     at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
> >     at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
> >     at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
> >     at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
> >     at
> > org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
> >     at
> > org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
> >     at
> > org.apache.tomcat.util.net <http://org.apache.tomcat.util.net/>.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
> >     at
> > org.apache.tomcat.util.net <http://org.apache.tomcat.util.net/>.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
> >     at
> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> >     at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> >     at
> > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> >     at java.lang.Thread.run(Thread.java:745)
> >
> >
> > I'm writing here because the message says this might indicate a bug in
> > hibernate.
> >
> > --
> > Regards, Petar!
> > Karlovo, Bulgaria.
> > ---
> > Public PGP Key at:
> > http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611 <http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611>
> > Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org <mailto:hibernate-dev at lists.jboss.org>
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev <https://lists.jboss.org/mailman/listinfo/hibernate-dev>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org <mailto:hibernate-dev at lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/hibernate-dev <https://lists.jboss.org/mailman/listinfo/hibernate-dev>



More information about the hibernate-dev mailing list