0 Replies Latest reply on Apr 23, 2006 12:44 AM by alfonsokim

    pk class

    alfonsokim

      hi,

      im using CMP in JBoss 4.0.1 and MySQL.

      I have one table that maps to this PK-class:

      package examenes.service.ejb.keys;
      
      public class ExamenesResueltosKey implements java.io.Serializable{
      
       public Integer idUsuario;
       public Integer idExamen;
       public Integer idReactivo;
      
       public ExamenesResueltosKey(){}
      
       public Integer getIdUsuario(){ return idUsuario; }
       public void setIdUsuario(Integer idUsuario){ this.idUsuario = idUsuario; }
       public Integer getIdExamen(){ return idExamen; }
       public void setIdExamen(Integer idExamen){ this.idExamen = idExamen; }
       public Integer getIdReactivo(){ return idReactivo; }
       public void getIdReactivo(Integer idReactivo){ this.idReactivo = idReactivo; }
      
       public boolean equals(Object elOtro){
       if(elOtro instanceof ExamenesResueltosKey){
       return ((((ExamenesResueltosKey)elOtro).getIdUsuario() == this.getIdUsuario()) &&
       (((ExamenesResueltosKey)elOtro).getIdExamen() == this.getIdExamen()) &&
       (((ExamenesResueltosKey)elOtro).getIdReactivo() == this.getIdReactivo()));
       }
       return false;
       }
      
       public int hashCode(){
       String jijos = ("" + this.getIdUsuario() + this.getIdExamen() + this.getIdReactivo());
       return jijos.hashCode();
       }
      
      }//clase


      -------------

      in ejb-jar.xml:

      <prim-key-class>examenes.service.ejb.keys.ExamenesResueltosKey</prim-key-class>

      I want to know how many <primkey-field>, because the pk-field is composed by 3 Integers

      also, in jbosscmp-jdbc.xml i down know what must be in

      <unknown-pk>
      <unknown-pk-class>
      <field-name>
      <column-name>
      <jdbc-type>
      <sql-type>
      </unknown-pk>

      i must map the 3 fields?

      thanks in advance, greetings from Mexico