Bug 1022405 - HHH-8578 Bulk delete cascading into many-to-many join table not properly handling where clause
HHH-8578 Bulk delete cascading into many-to-many join table not properly hand...
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate (Show other bugs)
6.2.0
Unspecified Unspecified
high Severity high
: ER7
: EAP 6.2.0
Assigned To: Brett Meyer
Zbyněk Roubalík
Russell Dickenson
: Regression
Depends On:
Blocks: 1022581
  Show dependency treegraph
 
Reported: 2013-10-23 04:37 EDT by Marek Schmidt
Modified: 2015-09-01 00:00 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
HHH-8578 https://hibernate.atlassian.net/browse/HHH-8578 HHH-8476 automatically removed entries in a many-to-many association table if orphaned. The logic incorrectly assumed a where clause was available in the query. HHH-8578 corrected this.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-12-15 11:19:18 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
modified kitchensink deltaspike quickstart (381.98 KB, application/x-webarchive)
2013-10-23 04:39 EDT, Marek Schmidt
no flags Details

  None (edit)
Description Marek Schmidt 2013-10-23 04:37:25 EDT
Description of problem:

There appears to be a regression in EAP 6.2.0 in parsing queries such as "delete from Foo" , e.g.:

entityManager.createQuery("delete from Member").executeUpdate();

The same query worked on EAP 6.1.1.

Version-Release number of selected component (if applicable):
EAP 6.2.0.ER6  (possibly since ER4)

How reproducible:

Put entityManager.createQuery("delete from Member").executeUpdate(); anywhere, or see the attached reproducer (modified kitchensink-deltaspike quickstart, any quickstart modified in this way would likely reproduce the problem)


Actual results:

an exception is thrown:

0:30:37,329 ERROR [org.hibernate.hql.internal.ast.ErrorCounter] (http-/127.0.0.1:8080-1) <AST>:0:0: unexpected end of subtree
10:30:37,330 ERROR [org.hibernate.hql.internal.ast.ErrorCounter] (http-/127.0.0.1:8080-1) <AST>:0:0: unexpected end of subtree: <AST>:0:0: unexpected end of subtree
	at org.hibernate.hql.internal.antlr.SqlGeneratorBase.whereClauseExpr(SqlGeneratorBase.java:1378) [hibernate-core-4.2.6.Final-redhat-1.jar:4.2.6.Final-redhat-1]
	at org.hibernate.hql.internal.antlr.SqlGeneratorBase.whereClause(SqlGeneratorBase.java:1272) [hibernate-core-4.2.6.Final-redhat-1.jar:4.2.6.Final-redhat-1]
	at org.hibernate.hql.internal.ast.exec.DeleteExecutor.<init>(DeleteExecutor.java:72) [hibernate-core-4.2.6.Final-redhat-1.jar:4.2.6.Final-redhat-1]
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.buildAppropriateStatementExecutor(QueryTranslatorImpl.java:535) [hibernate-core-4.2.6.Final-redhat-1.jar:4.2.6.Final-redhat-1]
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:201) [hibernate-core-4.2.6.Final-redhat-1.jar:4.2.6.Final-redhat-1]
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:138) [hibernate-core-4.2.6.Final-redhat-1.jar:4.2.6.Final-redhat-1]
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105) [hibernate-core-4.2.6.Final-redhat-1.jar:4.2.6.Final-redhat-1]
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80) [hibernate-core-4.2.6.Final-redhat-1.jar:4.2.6.Final-redhat-1]
	at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168) [hibernate-core-4.2.6.Final-redhat-1.jar:4.2.6.Final-redhat-1]
	at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:221) [hibernate-core-4.2.6.Final-redhat-1.jar:4.2.6.Final-redhat-1]
	at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:199) [hibernate-core-4.2.6.Final-redhat-1.jar:4.2.6.Final-redhat-1]
	at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1778) [hibernate-core-4.2.6.Final-redhat-1.jar:4.2.6.Final-redhat-1]
	at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:291) [hibernate-entitymanager-4.2.6.Final-redhat-1.jar:4.2.6.Final-redhat-1]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
	at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
	at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:45) [weld-core-1.1.16.Final-redhat-1.jar:1.1.16.Final-redhat-1]
	at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105) [weld-core-1.1.16.Final-redhat-1.jar:1.1.16.Final-redhat-1]
	at org.jboss.weld.proxies.EntityManager$722393672$Proxy$_$$_WeldClientProxy.createQuery(EntityManager$722393672$Proxy$_$$_WeldClientProxy.java) [weld-core-1.1.16.Final-redhat-1.jar:]
	at org.jboss.as.quickstarts.kitchensink.service.MemberRegistration.clear(MemberRegistration.java:48) [classes:]
	at org.jboss.as.quickstarts.kitchensink.service.MemberRegistration$Proxy$_$$_WeldSubclass.clear(MemberRegistration$Proxy$_$$_WeldSubclass.java) [classes:]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
	at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
	at org.jboss.weld.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:85) [weld-core-1.1.16.Final-redhat-1.jar:1.1.16.Final-redhat-1]
	at org.jboss.weld.interceptor.proxy.InterceptorInvocationContext.proceed(InterceptorInvocationContext.java:127) [weld-core-1.1.16.Final-redhat-1.jar:1.1.16.Final-redhat-1]
	at org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy.execute(ResourceLocalTransactionStrategy.java:115) [deltaspike-jpa-module-impl-0.5.jar:0.5]
	at org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor.executeInTransaction(TransactionalInterceptor.java:57) [deltaspike-jpa-module-impl-0.5.jar:0.5]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
	at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
	at org.jboss.weld.interceptor.proxy.SimpleMethodInvocation.invoke(SimpleMethodInvocation.java:30) [weld-core-1.1.16.Final-redhat-1.jar:1.1.16.Final-redhat-1]
	at org.jboss.weld.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:69) [weld-core-1.1.16.Final-redhat-1.jar:1.1.16.Final-redhat-1]
	at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:112) [weld-core-1.1.16.Final-redhat-1.jar:1.1.16.Final-redhat-1]
	at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:88) [weld-core-1.1.16.Final-redhat-1.jar:1.1.16.Final-redhat-1]
	at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:55) [weld-core-1.1.16.Final-redhat-1.jar:1.1.16.Final-redhat-1]
	at org.jboss.as.quickstarts.kitchensink.service.MemberRegistration$Proxy$_$$_WeldSubclass.clear(MemberRegistration$Proxy$_$$_WeldSubclass.java) [classes:]
	at org.jboss.as.quickstarts.kitchensink.controller.MemberController.clear(MemberController.java:60) [classes:]
	at org.jboss.as.quickstarts.kitchensink.controller.MemberController$Proxy$_$$_WeldClientProxy.clear(MemberController$Proxy$_$$_WeldClientProxy.java) [classes:]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
	at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
	at org.apache.el.parser.AstValue.invoke(AstValue.java:258) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
	at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
	at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40) [weld-core-1.1.16.Final-redhat-1.jar:1.1.16.Final-redhat-1]
	at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50) [weld-core-1.1.16.Final-redhat-1.jar:1.1.16.Final-redhat-1]
	at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:101) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
	at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:786) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
	at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:927) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
	at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
	at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.3.0.Final-redhat-9.jar:7.3.0.Final-redhat-9]
	at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.3.0.Final-redhat-9.jar:7.3.0.Final-redhat-9]
	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.3.0.Final-redhat-9.jar:7.3.0.Final-redhat-9]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
	at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]


Expected results:

The statement should delete all "Member" entities

Additional info:
Comment 1 Marek Schmidt 2013-10-23 04:39:11 EDT
Created attachment 815271 [details]
modified kitchensink deltaspike quickstart

(to reproduce the issue deploy the modified quickstart, open
http://127.0.0.1:8080/jboss-kitchensink-deltaspike/index.jsf

and click 

"Remove all"
Comment 2 Zbyněk Roubalík 2013-10-23 07:29:28 EDT
It seems to be this issue:

https://hibernate.atlassian.net/browse/HHH-8614
Comment 5 Brett Meyer 2013-10-23 10:48:02 EDT
It's not HHH-8614 -- that was rejected as a duplicate.  Corrected under https://hibernate.atlassian.net/browse/HHH-8578.

Is it too late for another 6.2 build?
Comment 7 Martin Simka 2013-11-08 06:03:05 EST
verified on EAP 6.2.0.ER7
Comment 8 Russell Dickenson 2013-12-01 20:27:48 EST
Attention: Developers



To my mind, since this issue only affected EAP 6.2.0 (possibly Beta) and it is already resolved, this BZ ticket does not require a release notes entry. Do you agree.

Note You need to log in before you can comment on or make changes to this bug.