2 Replies Latest reply on Jan 8, 2003 8:19 AM by Alankar

    Getting Exceptions when trying to use CMP for a database tab

    Alankar Newbie

      Hi guys

      I need help on this one !!

      Ok ..I have a database table whic represented many to many mapping between two tables.
      The table has two columns : emp_id and orgrole_id
      I do not have any primary key in this table

      Now after generating the CMP for this table using Jdeveloper from oracle I tried to call the create, find all functions though a client but when i do that I get error below : Can some one please tell me how can i fix this ...

      java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.ServerException: RuntimeException; nested exception is:
      java.lang.IllegalStateException: removing bean lock and it has tx set!Skill_emp mypackage2.Skill_empPK@bfb235

      java.rmi.ServerException: RuntimeException; nested exception is:
      java.lang.IllegalStateException: removing bean lock and it has tx set!Skill_emp mypackage2.Skill_empPK@bfb235

      java.lang.IllegalStateException: removing bean lock and it has tx set!Skill_emp mypackage2.Skill_empPK@bfb235

      void sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(java.lang.Exception)

      StreamRemoteCall.java:245

      void sun.rmi.transport.StreamRemoteCall.executeCall()

      StreamRemoteCall.java:220

      java.lang.Object sun.rmi.server.UnicastRef.invoke(java.rmi.Remote, java.lang.reflect.Method, java.lang.Object[], long)

      UnicastRef.java:122

      java.lang.Object org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(org.jboss.invocation.Invocation)

      java.lang.Object org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(org.jboss.invocation.Invocation)

      JRMPInvokerProxy.java:138

      java.lang.Object org.jboss.invocation.InvokerInterceptor.invoke(org.jboss.invocation.Invocation)

      InvokerInterceptor.java:108

      java.lang.Object org.jboss.proxy.TransactionInterceptor.invoke(org.jboss.invocation.Invocation)

      TransactionInterceptor.java:77

      java.lang.Object org.jboss.proxy.SecurityInterceptor.invoke(org.jboss.invocation.Invocation)

      SecurityInterceptor.java:80

      java.lang.Object org.jboss.proxy.ejb.EntityInterceptor.invoke(org.jboss.invocation.Invocation)

      EntityInterceptor.java:116

      java.lang.Object org.jboss.proxy.ClientContainer.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])

      ClientContainer.java:76

      void $Proxy1.setSkill_level(java.lang.Long)

      void Samplemypackage2.Skill_empClient.main(java.lang.String[])

      Skill_empClient.java:23

        • 1. Re: Getting Exceptions when trying to use CMP for a database
          Alankar Newbie

          Hey guys ... more more input to my query
          I have tried to deploy the same EJB on the "Embedded OC4J server" from JDeveloper and I was able to get it working ...but when i deployee the same thing in jboss it doesn't seem to work :(

          • 2. Re: Getting Exceptions when trying to use CMP for a database
            Alankar Newbie

            I got it working ...finally !!!

            hope this helps someone .... ok the mistake i was doing was in my primary class

            package mypackage4;
            import java.io.Serializable;

            public class EmprolePK implements Serializable {
            public Long orgrole_id;
            public Long emp_id;

            public EmprolePK() {
            }

            public EmprolePK(Long emp_id, Long orgrole_id) throws javax.ejb.CreateException {
            this.emp_id = emp_id;
            this.orgrole_id = orgrole_id;
            }

            public boolean equals(Object other) {
            if (other instanceof EmprolePK) {
            final EmprolePK otherEmprolePK = (EmprolePK)other;

            // The following assignment statement is auto-maintained and may be overwritten!
            boolean areEqual = (otherEmprolePK.emp_id.equals(emp_id) && otherEmprolePK.orgrole_id.equals(orgrole_id));

            return areEqual;
            }

            return false;
            }

            public int hashCode() {

            return emp_id.hashCode();
            }
            }

            I just returned emp_id.hashcode() instead of super.hashcode and it worked.

            Can someone please tell me what will be the implication of this on my code ... is it a bad design in any way