4 Replies Latest reply on Jan 29, 2003 6:05 PM by dg

    Object with primary key  not found in storage

    dg Newbie

      Would greatly appreciate any info on fixing this type of error:

      Object with primary key ... not found in storage

      more specifically:
      14:14:08,961 ERROR [BookingManagerBean] Object with primary key edu.msm.scil.conductor.ejb.ResourceTypePK@682b72 not found in storage

      I've confirmed that the class exists & is public & is in the ejb-jar.xml:
      <prim-key-class>edu.msm.scil.conductor.ejb.ResourceTypePK</prim-key-class>

      and tried this with no success:
      <prim-key-class>java.lang.Object</prim-key-
      class>

      also leaving blank
      <prim-key-class></prim-key-
      ?????
      thanks thanks thanks


        • 1. Re: Object with primary key  not found in storage
          Raja Master

          Are you sure the key you are searching does exist in teh database? This comes from teh findbyprimarykey implementation and from the source code, it looks like this occurs if the key that u input is not found in teh DB.

          -Raj

          • 2. Re: Object with primary key  not found in storage
            dg Newbie

            I know that all of the objects & primary key exist -
            is the 682b72 value in hex??
            if it is, that value does Not exist

            the class declares the datatype as:
            public long resource_type_id;
            but the db was ported from oracle to postgres, which created resource_type_id as integer (postgres has no long datatype) - don't know if that would throw it off or not...
            thanks for your response(s)

            • 3. Re: Object with primary key  not found in storage
              Raja Master

              Sorry if i dint understand u right.
              Is ur Primary key class
              edu.msm.scil.conductor.ejb.ResourceTypePK?

              the one in the error message is the PrimaryKey.toString() representation of the object that you passed in.

              Can you show your client that makes this call? If your primary key is a long and you are wrapping it into ResourceTypePK class, create the ResourceTypePK object, populate the value for hte long and pass it onto findByPrimaryKey.

              HTH

              • 4. Re: Object with primary key  not found in storage
                dg Newbie

                Hi HTH,

                here's the package code - I inherited this large EAR from someone else (gone) so I'm groping around.
                I changed the postgres datatypes to bigint to match a long more closely
                still groping...
                thank you sir

                package edu.msm.scil.conductor.ejb;
                import java.io.Serializable;

                public class ResourceTypePK implements Serializable
                {
                public long resource_type_id;

                public ResourceTypePK()
                {
                }

                public ResourceTypePK(long resource_type_id)
                {
                this.resource_type_id = resource_type_id;
                }

                public boolean equals(Object other)
                {
                // Add custom equals() impl here
                return super.equals(other);
                }

                public int hashCode()
                {
                // Add custom hashCode() impl here
                return super.hashCode();
                }
                }