Hi Simone,

I'll try doing String.hashCode()

1. OS: I'm using Slackware Linux, Blackdown JDK1.3 with Jbos PRE2-1 Dec 3
2. Client code:
    /**
     * doAcctDescrEdit - changes account description names
     * @param Map dbMap - a map html form values to database table columns
     */
protected void doAcctDescEditEjb(Map dbMap) throws Exception {
   TebNomlHome tebNomlHome = (TebNomlHome)
initialContext.lookup("qsp.TebNomlHome");
   TebNomlPk tebNomlPk = new TebNomlPk((String)dbMap.get(DB_CMPY),

(String)dbMap.get(DB_NOMLVAL),1);
   TebNoml tebNoml = tebNomlHome.findByPrimaryKey(tebNomlPk);
   tebNoml.setDescr_30((String)dbMap.get(DB_DESCR30));
}

3. Err msg
 Unknown status code: javax.ejb.ObjectNotFoundException:
Object with primary key
net.qspasp.ejbs.gl.tebnoml.TebNomlPk@3ad33d not found in
storage

4. Also I'm using whatever default CMP server the comes with Jboss
Paul Russo wrote:

> I have a primary key with multiple fields.
> When I try to do a findByPrimary key from a client, I get Object not
> found in storage. I know the database row exists.  Also, I can make
> other findByPrimaryKey for CMP work by using a single field with no
> primary key class.
>
> I've included the primaryKey class and ejb-jar.xml and jaws xml files.
>
> I thank anybody who would take the time to look at this.
>
> package net.qspasp.ejbs.gl.tebnoml;
>
> public class TebNomlPk implements java.io.Serializable {
>     public String cmpy;
>     public String noml;
>     public int path;
>
>     private int hashCode;
>
>     public TebNomlPk() {
>     }
>
>     public TebNomlPk(String cmpy, String noml, int path) {
>  this.cmpy = cmpy;
>  this.noml = noml;
>  this.path = path;
>
>  StringBuffer buff = new StringBuffer();
>  buff.append(cmpy);
>  buff.append(noml);
>  buff.append(path);
>  hashCode =  buff.hashCode();
>     }
>
>     public boolean equals(Object key) {
>  System.out.println("equals method");
>  if ( (key == null)
>       || !(key instanceof TebNomlPk) ) {
>      System.out.println("equals =f1");
>      return false;
>  }
>  if ( (((TebNomlPk)key).cmpy.equals(cmpy))
>       && (((TebNomlPk)key).noml.equals(noml))
>       && (((TebNomlPk)key).path == (path)) ) {
>      System.out.println("equals =t1");
>      return true;
>  } else {
>      System.out.println("equals =f2");
>      return false;
>  }
>     }
>
>     public int hashCode() {
>  return hashCode;
>     }
> }
>
> ejb-jar.xml
> --------------------
> <?xml version="1.0"?>
>
> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
> JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">
>
> <ejb-jar>
>   <enterprise-beans>
>     <entity>
>       <description>Deployment descriptor for TebNoml bean</description>
>       <ejb-name>TebNomlHome</ejb-name>
>       <home>net.qspasp.ejbs.gl.tebnoml.TebNomlHome</home>
>       <remote>net.qspasp.ejbs.gl.tebnoml.TebNoml</remote>
>       <ejb-class>net.qspasp.ejbs.gl.tebnoml.TebNomlBean</ejb-class>
>       <persistence-type>Container</persistence-type>
>
> <prim-key-class>net.qspasp.ejbs.gl.tebnoml.TebNomlPk</prim-key-class>
>       <reentrant>False</reentrant>
>       <cmp-field><field-name>cmpy</field-name></cmp-field>
>       <cmp-field><field-name>path</field-name></cmp-field>
>       <cmp-field><field-name>noml</field-name></cmp-field>
>       <cmp-field><field-name>descr_30</field-name></cmp-field>
>       <resource-ref>
>          <description>A jdbc connection for the CMP bean</description>
>                 <res-ref-name>QspDBPool</res-ref-name>
>                 <res-type>javax.sql.DataSource</res-type>
>                 <res-auth>Container</res-auth>
>       </resource-ref>
>     </entity>
>   </enterprise-beans>
> </ejb-jar>
>
> jaws.xml
> ---------
>
> <jaws>
>     <datasource>xa.QspDBPool</datasource>
>     <type-mapping>Oracle</type-mapping>
>
>     <default-entity>
>        <create-table>true</create-table>
>        <remove-table>false</remove-table>
>        <tuned-updates>true</tuned-updates>
>        <read-only>false</read-only>
>        <time-out>300</time-out>
>     </default-entity>
>
>     <type-mappings>
>         <type-mapping>
>             <name>Oracle</name>
>             <mapping>
>                 <java-type>java.lang.Long</java-type>
>                 <jdbc-type>BIGINT</jdbc-type>
>                 <sql-type>NUMBER</sql-type>
>             </mapping>
>             <mapping>
>                 <java-type>java.lang.String</java-type>
>                 <jdbc-type>VARCHAR</jdbc-type>
>                 <sql-type>VARCHAR(256)</sql-type>
>             </mapping>
>             <mapping>
>                 <java-type>java.lang.String</java-type>
>                 <jdbc-type>VARCHAR</jdbc-type>
>                 <sql-type>CHAR</sql-type>
>             </mapping>
>             <mapping>
>                 <java-type>java.lang.Character</java-type>
>                 <jdbc-type>CHAR</jdbc-type>
>                 <sql-type>CHAR</sql-type>
>             </mapping>
>             <mapping>
>                 <java-type>java.lang.Short</java-type>
>                 <jdbc-type>INTEGER</jdbc-type>
>                 <sql-type>NUMBER</sql-type>
>             </mapping>
>             <mapping>
>                 <java-type>java.sql.TimeStamp</java-type>
>                 <jdbc-type>TIMESTAMP</jdbc-type>
>                 <sql-type>TIMESTAMP</sql-type>
>             </mapping>
>             <mapping>
>                 <java-type>java.lang.Double</java-type>
>                 <jdbc-type>DOUBLE</jdbc-type>
>                 <sql-type>NUMBER</sql-type>
>             </mapping>
>             <mapping>
>                 <java-type>java.lang.Byte</java-type>
>                 <jdbc-type>TINYINT</jdbc-type>
>                 <sql-type>NUMBER</sql-type>
>             </mapping>
>             <mapping>
>                 <java-type>java.lang.Boolean</java-type>
>                 <jdbc-type>BIT</jdbc-type>
>                 <sql-type>NUMBER</sql-type>
>             </mapping>
>             <mapping>
>                 <java-type>java.lang.Float</java-type>
>                 <jdbc-type>FLOAT</jdbc-type>
>                 <sql-type>NUMBER</sql-type>
>             </mapping>
>             <mapping>
>                 <java-type>java.lang.Object</java-type>
>                 <jdbc-type>JAVA_OBJECT</jdbc-type>
>                 <sql-type>JAVA_OBJECT</sql-type>
>             </mapping>
>             <mapping>
>                 <java-type>java.util.Date</java-type>
>                 <jdbc-type>DATE</jdbc-type>
>                 <sql-type>DATE</sql-type>
>             </mapping>
>             <mapping>
>                 <java-type>java.lang.Integer</java-type>
>                 <jdbc-type>INTEGER</jdbc-type>
>                 <sql-type>NUMBER</sql-type>
>             </mapping>
>         </type-mapping>
>     </type-mappings>
>
> <enterprise-beans>
>      <entity>
>        <ejb-name>TebNomlHome</ejb-name>
>        <table-name>TEBNOML</table-name>
>        <create-table>false</create-table>
>        <cmp-field>
>          <field-name>cmpy</field-name>
>          <column-name>CMPY</column-name>
>    <jdbc-type>VARCHAR</jdbc-type>
>           <sql-type>VARCHAR(2)</sql-type>
>        </cmp-field>
>        <cmp-field>
>          <field-name>noml</field-name>
>          <column-name>NOML</column-name>
>    <jdbc-type>VARCHAR</jdbc-type>
>           <sql-type>VARCHAR(20)</sql-type>
>        </cmp-field>
>        <cmp-field>
>          <field-name>path</field-name>
>          <column-name>PATH</column-name>
>   <jdbc-type>INTEGER</jdbc-type>
>           <sql-type>NUMBER</sql-type>
>        </cmp-field>
>        <cmp-field>
>          <field-name>descr_30</field-name>
>          <column-name>DESCR_30</column-name>
>        </cmp-field>
>      </entity>
>    </enterprise-beans>
> </jaws>



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to