-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Error while deleting collection
PostPosted: Sun Feb 04, 2007 8:49 pm 
Newbie

Joined: Sun Feb 04, 2007 8:41 pm
Posts: 2
Hi,

I have a parent child relation ship with one-to-many. I load the parent along with set of children, I have to update this set. I tried various options but every time I get the error:

8:45:58,980 ERROR [LogInterceptor] EJBException in method: public abstract gov.ms.mdes.access.framework.service.IObjectAssembly gov.ms.mdes.access.framework.service.BIService.executeTxn(gov.ms.mdes.access.framework.service.IObjectAssembly,java.lang.String,java.lang.String,gov.ms.mdes.access.framework.context.UserContext) throws java.rmi.RemoteException, causedBy:
gov.ms.mdes.access.framework.exception.BaseRunTimeException: null
Inner Exception :org.hibernate.exception.ConstraintViolationException:could not delete collection: [gov.ms.mdes.access.domain.data.ClaimData.claimEmployments#1176]
at gov.ms.mdes.access.framework.exception.BaseRunTimeException.wrapAndThrow(BaseRunTimeException.java:146)
at gov.ms.mdes.access.framework.service.ServiceDelegate.executeTxn(ServiceDelegate.java:46)
at gov.ms.mdes.access.framework.service.ejb.ServiceSessionFacadeBean.executeTxn(ServiceSessionFacadeBean.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:317)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:150)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:111)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:709)
at sun.reflect.GeneratedMethodAccessor221.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:62)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:54)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:82)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:198)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:97)
at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:115)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:101)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
at $Proxy46.executeTxn(Unknown Source)
at gov.ms.mdes.access.framework.service.BusinessDelegate.executeServiceMethod(BusinessDelegate.java:40)
at gov.ms.mdes.access.framework.struts.BaseLookUpDispatchAction.executeServiceMethod(BaseLookUpDispatchAction.java:418)
at gov.ms.mdes.access.framework.struts.BaseLookUpDispatchAction.execute(BaseLookUpDispatchAction.java:209)
at gov.ms.mdes.access.framework.struts.CustomRequestProcessor.processActionPerform(CustomRequestProcessor.java:325)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at gov.ms.mdes.access.framework.struts.CustomActionServlet.process(CustomActionServlet.java:120)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at gov.ms.mdes.access.web.filter.SessionAttributeRemoveFilter.doFilter(SessionAttributeRemoveFilter.java:48)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at gov.ms.mdes.access.web.filter.SecurityFilter.doFilter(SecurityFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:162)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at gov.ms.mdes.access.framework.service.ServiceDelegate.executeTxn(ServiceDelegate.java:37)
... 80 more


Following is the mapping

for ClaimData class
<set lazy="true" cascade="all-delete-orphan" name="claimEmployments">
<key column="CLAIM_ID"/>
<one-to-many class="gov.ms.mdes.access.domain.data.ClaimEmploymentData"/>
</set>

for ClaimEmpolymentData class
<many-to-one not-null="true" column="CLAIM_ID" name="claimData" class="gov.ms.mdes.access.domain.data.ClaimData"/>

in code i am trying to do

for (Iterator it = this.claimData.getClaimEmployments().iterator(); it.hasNext();){
ClaimEmploymentData clmEmpData = (ClaimEmploymentData)it.next();
this.claimData.getClaimEmployments().remove(clmEmpData);
this.claimDao.delete(clmEmpData);
}

session().flush();

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 04, 2007 10:06 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
The details of your constraint violation exception are being swallowed somewhere. Try deleting something from the relevant collection by hand, to see which constraint is being violated.

Note that you don't have to remove and delete clmEmpData, because you've set cascade="all-delete-orphan". A much more legible version of what you've done is
Code:
claimData.getClaimEmployments().clear();
session().flush();

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 05, 2007 11:40 am 
Newbie

Joined: Sun Feb 04, 2007 8:41 pm
Posts: 2
thanks yu for the quick response,
will try to chk the contraint violaton dtails and repost


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.