2 Replies Latest reply on Nov 19, 2002 9:48 PM by minamoto

    The class must provide suitable implementation of the equals

    butterflee

      When deploy some entity bean(BMP), it displays following messages:

      Bean : SomeEntityBean
      Section: 12.2.12
      Warning: The class must provide suitable implementation of the equals(Object other) method.

      what does this mean and its impact?
      many thanks

        • 1. Re: The class must provide suitable implementation of the eq

          From the verifier...

          cls = classloader.loadClass(entity.getPrimaryKeyClass());

          Object one = cls.newInstance();
          Object two = cls.newInstance();

          try
          {
          if( !one.equals(two) )
          {
          if( cmp )
          {
          fireSpecViolationEvent( entity, new Section("10.6.13.c"));
          }
          else
          {
          fireSpecViolationEvent( entity, new Section("12.2.12.c"));
          }
          status = false;
          }
          }
          catch(NullPointerException e)
          {
          // That's OK - the implementor expected the fields to
          // have values
          }

          From the spec ...

          The class must provide suitable implementation of the hashCode() and equals(Object
          other) methods to simplify the management of the primary keys by client code.

          Regards,
          Adrian

          • 2. Re: The class must provide suitable implementation of the eq
            minamoto

            As section 12.2.12 of the ejb 2.0 spec says, it's about the primary key.
            This message may mean that the verifier cannot find the primary key class in the ejb-jar.xml.

            Miki