3 Replies Latest reply on Aug 18, 2004 5:52 PM by sbrbot

    Composite key -CMP Bean

    anilpopnet

      I am using jboss-3.2.1_tomcat-4.1.24.

      CMP bean having composite key throws following exception.

      javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=com.csam.wsc.auth.ejb.bean.ServicePK@2e284fbd
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:158)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:483)
      at org.jboss.ejb.Container.invoke(Container.java:674)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:353)
      at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
      at $Proxy530.getService(Unknown Source)
      at com.csam.wsc.auth.ejb.bean.ServiceBrowserBean.getComponentServices(Unknown Source)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:629)
      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:243)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117)

        • 1. Re: Composite key -CMP Bean

          Hi anil,
          Did you find the solution to your composite key problem. I am also having the same problem. I however can write records to table, but it crashes on me whenever I try to read the record.

          I struggled with it for a while before I realized it's the composite key problem. I was for a long time looking for datetime part of my composite key.

          I have the Composite Key class defined (it also implements Serializable interface) and overwrites hashCode and equals methods.

          regards
          vss

          • 2. Re: Composite key -CMP Bean
            aloubyansky

            Make sure you have a proper implement for hashCode and equals?

            • 3. Re: Composite key -CMP Bean
              sbrbot

              In composite key class one must have exactly the same names of getters/setters as defined in EJB using this composite PK class. So if your SomeEJB has getId1 and getId2 methods which are mapped on PK fields, then your SomePK must have exactly the same getId1 and getId2 methods!