<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Error while deleting membership
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/crayaug15">crazy aug15</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/602443#602443">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Code:</p><p>=====</p><p>try{</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IdentitySession isession = helperBean.getIdentitySession();&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; User user = isession.getUserByName("test");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Group group = isession.getGroupByName("test");</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Membership membership = new Membership();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; membership.setGroup(group);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; membership.setUser(user);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; isession.deleteEntity(memship);//deleting membership</p><p>}finally{&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; helperBean.getJbpmContext().close();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Error thrown</p><p>=========</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>[4/28/11 12:11:44:802 IST] 00000116 SystemOut&#160;&#160;&#160;&#160; O Membership id is: 2505User name is: testGroup Name is: test</p><p>[4/28/11 12:11:44:802 IST] 00000116 SystemOut&#160;&#160;&#160;&#160; 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_=?</p><p>[4/28/11 12:11:45:568 IST] 00000116 ServletWrappe E&#160;&#160; SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: Test18. Exception thrown : org.jbpm.persistence.JbpmPersistenceException: transaction commit failed</p><p>&#160;&#160;&#160; at org.jbpm.persistence.db.DbPersistenceService.endTransaction(DbPersistenceService.java:140)</p><p>&#160;&#160;&#160; at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:201)</p><p>&#160;&#160;&#160; at org.jbpm.svc.Services.close(Services.java:247)</p><p>&#160;&#160;&#160; at org.jbpm.JbpmContext.close(JbpmContext.java:131)</p><p>&#160;&#160;&#160; at com.cisco.bpm.workflow.service.impl.JBPMUserManagementServiceImpl.removeUserFromGroup(JBPMUserManagementServiceImpl.java:567)</p><p>&#160;&#160;&#160; at com.TestClass.&lt;init&gt;(TestClass.java:85)</p><p>&#160;&#160;&#160; at Test18.doGet(Test18.java:32)</p><p>&#160;&#160;&#160; at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)</p><p>&#160;&#160;&#160; at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)</p><p>&#160;&#160;&#160; at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1103)</p><p>&#160;&#160;&#160; at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570)</p><p>&#160;&#160;&#160; at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:486)</p><p>&#160;&#160;&#160; at com.ibm.ws.webcontainer.extension.InvokerExtensionProcessor.handleRequest(InvokerExtensionProcessor.java:449)</p><p>&#160;&#160;&#160; at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3440)</p><p>&#160;&#160;&#160; at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)</p><p>&#160;&#160;&#160; at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)</p><p>&#160;&#160;&#160; at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1461)</p><p>&#160;&#160;&#160; at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:118)</p><p>&#160;&#160;&#160; at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)</p><p>&#160;&#160;&#160; at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)</p><p>&#160;&#160;&#160; at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)</p><p>&#160;&#160;&#160; at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1037)</p><p>&#160;&#160;&#160; at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:644)</p><p>&#160;&#160;&#160; at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818)</p><p>&#160;&#160;&#160; at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)</p><p>&#160;&#160;&#160; at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)</p><p>&#160;&#160;&#160; at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)</p><p>&#160;&#160;&#160; at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)</p><p>&#160;&#160;&#160; at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)</p><p>&#160;&#160;&#160; at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)</p><p>&#160;&#160;&#160; at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)</p><p>&#160;&#160;&#160; at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)</p><p>Caused by: org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [org.jbpm.identity.Membership#2502]</p><p>&#160;&#160;&#160; at org.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:993)</p><p>&#160;&#160;&#160; at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:168)</p><p>&#160;&#160;&#160; at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)</p><p>&#160;&#160;&#160; at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)</p><p>&#160;&#160;&#160; at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:520)</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/602443#602443">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>