Discussions

EJB design: URGENT - ejbc problem ...

  1. URGENT - ejbc problem ... (4 messages)

    Hi !
    I use weblogic 5.1. I've created jar file manually. But when I try to generate container classes using ejbc, I get the following error:
    ERROR: Error from ejbc: [9.2.9] In EJB Test, the primary key class must implement the method public int hachCode()

    ERROR: Error from ejbc: [9.2.9] In EJB Test, the primary key class must implement the method boolean equals <Object other>.
    ERROR: ejbc found errors.

    Then I included the two methods in my Primary class files ()returning 0 and false). But still I get the same errors.
    Could any one help me out regarding this problem. It is very urgent.

    Thanx
    AJP

    Threaded Messages (4)

  2. URGENT - ejbc problem ...[ Go to top ]


    I think it would be a good idea if u can show ur Primary key class.

  3. URGENT - ejbc problem ...[ Go to top ]

    hi
    see the primary key class must implement hashcode and equals object method
    so u must ev these methods dclared in ur class
    than compile this class first remove previous class file
    now run ur bean
  4. URGENT - ejbc problem ...[ Go to top ]

    package hitachi.buyplan;
    Hi !
    This is my Primary key class. Still I get the problem.

    import java.io.Serializable;
    public class TestPK implements Serializable
    {
        public TestPK(){}

        public int hashCode()
        {
            return 0;
        }
        public boolean equals(Object obj)
        {
                return false;
        }
    }

    Thanx.
    AJP
  5. URGENT - ejbc problem ...[ Go to top ]

    Hi,

    Change u'r PK file as follows:

    public class TestPK implements java.io.Serializable
    {
        public int id;
        public TestPK(){}


        public int hashCode()
        {
            return id;
        }
        public boolean equals(Object obj)
        {
            if(obj instanceof TestPK)
            {
                return (id == ((TestPK)obj).id);
            }
            return false;
        }
        public String toString()
        {
           return String.valueOf(id);
        }
    }

    Hope it should work now.

    Regards
    Saran