0 Replies Latest reply: Nov 15, 2011 10:42 AM by 897118 RSS

    [EJB:010142] error for cascade-delete

    897118
      Hi,

      I'm getting [EJB:010142] error (Instance of EJB <relatedEJB> with primary key <pk> does not exist) while trying to implement a straight-forward cascade-delete option in ejb-jar.xml for a one-to-many relationship using EJB 2.1.

      While the cascade-delete works well for a one-to-one relationship, it is throwing this error for one-to-many relationship.

      DB used is Oracle 10g XE. Server is Weblogic 9.2 MP4.

      Given below the exact error:

      javax.ejb.EJBException: EJB Exception:: java.lang.IllegalArgumentException: [EJB:010142]Instance of EJB 'LineItem' with primary key 'li8' does not exist.
           at Test1.Order_cpl9bk__WebLogic_CMP_RDBMS_lineItems_Set.remove(Order_cpl9bk__WebLogic_CMP_RDBMS_lineItems_Set.java:531)
           at Test1.Order_cpl9bk__WebLogic_CMP_RDBMS_lineItems_Set.remove(Order_cpl9bk__WebLogic_CMP_RDBMS_lineItems_Set.java:496)
           at Test1.Order_cpl9bk__WebLogic_CMP_RDBMS_lineItems_Set.clear(Order_cpl9bk__WebLogic_CMP_RDBMS_lineItems_Set.java:369)
           at Test1.Order_cpl9bk__WebLogic_CMP_RDBMS.__WL_superEjbRemove(Order_cpl9bk__WebLogic_CMP_RDBMS.java:1667)
           at weblogic.ejb.container.manager.DBManager.remove(DBManager.java:1664)
           at weblogic.ejb.container.internal.EntityEJBLocalObject.remove(EntityEJBLocalObject.java:125)
           at Test1.Order_cpl9bk_ELOImpl.remove(Order_cpl9bk_ELOImpl.java:577)
           at jsp_servlet.__cascadedeletetest._jspService(__cascadedeletetest.java:198)
           at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
           at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
           at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
           at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
           at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
           at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3272)
           at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
           at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
           at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2019)
           at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1925)
           at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1394)
           at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
           at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
      ; nested exception is: java.lang.IllegalArgumentException: [EJB:010142]Instance of EJB 'LineItem' with primary key 'li8' does not exist.
           at weblogic.ejb.container.internal.EJBRuntimeUtils.throwEJBException(EJBRuntimeUtils.java:141)
           at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:657)
           at weblogic.ejb.container.internal.BaseEJBLocalHome.handleSystemException(BaseEJBLocalHome.java:150)
           at weblogic.ejb.container.internal.EntityEJBLocalObject.remove(EntityEJBLocalObject.java:132)
           at Test1.Order_cpl9bk_ELOImpl.remove(Order_cpl9bk_ELOImpl.java:577)
           at jsp_servlet.__cascadedeletetest._jspService(__cascadedeletetest.java:198)
           at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
           at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
           at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
           at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
           at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
           at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3272)
           at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
           at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
           at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2019)
           at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1925)
           at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1394)
           at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
           at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)


      I have verified that the lineitem record that it is trying to delete is existing in the db table.

      Please let me know what could be the possible issue.

      Thanks,
      Vinod