crazy aug15 [
http://community.jboss.org/people/crayaug15] created the discussion
"Error while deleting membership"
To view the discussion, visit:
http://community.jboss.org/message/602443#602443
--------------------------------------------------------------
Hi,
In my code i need to delete the memebership. I am using below code for deleting the
membership but it is thrwoing error. Please help me on this.
Code:
=====
try{
IdentitySession isession = helperBean.getIdentitySession();
User user = isession.getUserByName("test");
Group group = isession.getGroupByName("test");
Membership membership = new Membership();
membership.setGroup(group);
membership.setUser(user);
isession.deleteEntity(memship);//deleting membership
}finally{
helperBean.getJbpmContext().close();
}
Error thrown
=========
[4/28/11 12:11:44:802 IST] 00000116 SystemOut O Membership id is: 2505User name is:
testGroup Name is: test
[4/28/11 12:11:44:802 IST] 00000116 SystemOut O Hibernate: select permission0_.ENTITY_
as ENTITY1_0_, permission0_.CLASS_ as CLASS2_0_, permission0_.NAME_ as NAME3_0_,
permission0_.ACTION_ as ACTION4_0_ from JBPM_ID_PERMISSIONS permission0_ where
permission0_.ENTITY_=?
[4/28/11 12:11:45:568 IST] 00000116 ServletWrappe E SRVE0068E: Uncaught exception thrown
in one of the service methods of the servlet: Test18. Exception thrown :
org.jbpm.persistence.JbpmPersistenceException: transaction commit failed
at
org.jbpm.persistence.db.DbPersistenceService.endTransaction(DbPersistenceService.java:140)
at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:201)
at org.jbpm.svc.Services.close(Services.java:247)
at org.jbpm.JbpmContext.close(JbpmContext.java:131)
at
com.cisco.bpm.workflow.service.impl.JBPMUserManagementServiceImpl.removeUserFromGroup(JBPMUserManagementServiceImpl.java:567)
at com.TestClass.<init>(TestClass.java:85)
at Test18.doGet(Test18.java:32)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1103)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570)
at
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:486)
at
com.ibm.ws.webcontainer.extension.InvokerExtensionProcessor.handleRequest(InvokerExtensionProcessor.java:449)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3440)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1461)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:118)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)
at
com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1037)
at
com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:644)
at
com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818)
at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
Caused by: org.hibernate.ObjectDeletedException: deleted object would be re-saved by
cascade (remove deleted object from associations): [org.jbpm.identity.Membership#2502]
at org.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:993)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:168)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:520)
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/602443#602443]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]