Hi!
At first I�m sorry because my english level isn�t very good.
I�m working with J2SDKEE1.2.1. and I�ve problems with CMP and Windows 2000.
I�ve a EJB(CPersonaEJB,CPersonaHome,CPersona,CPersonaPK=EntityBean
class,interface home,interface remote,Primary key class).My primary key
field is an int.In the Application Deployment Tool running the new
Enterprise Bean Wizard I enter in the primary key class field:CPersonaPK;
and in the primary key Field Name field I select id_contperson.

When I run a client we have 2 problems with the methods :findByPrimaryKey
and getPrimaryKey.
With findByPrimaryKey I get the next messages:

javax.ejb.FinderException: ERROR in database SELECT for
find:java.sql.SQLException: Invalid column type:setObject


Whit getPrimaryKey I get the next messages:
When I try to convert the object returned by the method getPrimaryKey into
CPersonaPK Class, I can�t because there is the nest Exception:
java.lang.ClassException


My code is:
<<CPersonaPK>>:
public class CPersonaPK implements java.io.Serializable {

  public int id_contperson;
  public CPersonaPK(){}
  public int hashCode() {
    return id_contperson;
  }
  public boolean equals(Object obj) {
    if(obj == null || !(obj instanceof CPersonaPK))
      return false;
    else if (((CPersonaPK)obj).id_contperson==id_contperson)
      return true;
    else
      return false;
  }
}
---------------------------
<<CPersonaEJB>>:

import java.sql.*;
import java.sql.Date;
import javax.sql.*;
import java.util.*;
import javax.ejb.*;
import javax.naming.*;
import java.lang.Integer;

public class CPersonaEJB implements EntityBean {
        private int id_usuario;
        public String nombre;
        public String apellidos;
        public String email;
        public String telefono;
        public String fax;
        public String direccion;
        public String cp;
        public String ciudad;
        public String pais;
        public String infoadi;
        public String departamento;
        public String categoria;
        public int id_contperson;
        private int id_generador_contperson;
        private EntityContext contexto;

        public CPersonaPK ejbCreate(int id_contperson,String nombre,String
apellidos,String email,String telefono,String fax,String direccion,String
cp,String ciudad,String pais,String infoadi,String departamento,String
categoria)
                throws CreateException {

                        this.nombre=nombre;
                        this.apellidos=apellidos;
                        this.email=email;
                        this.telefono=telefono;
                        this.fax=fax;
                        this.direccion=direccion;
                        this.cp=cp;
                        this.ciudad=ciudad;
                        this.pais=pais;
                        this.infoadi=infoadi;
                        this.departamento=departamento;
                        this.categoria=categoria;
                        this.id_contperson=id_contperson;
                        return null;    }

        public void ejbPostCreate(int id_contperson,String nombre,String
apellidos,String email,String telefono,String fax,String direccion,String
cp,String ciudad,String pais,String infoadi,String departamento,String
categoria){}
        public void ejbLoad(){}
        public void ejbStore(){}
        public void ejbActivate(){}
        public void ejbPassivate(){}
        public void ejbRemove(){}
        public void setEntityContext (EntityContext contexto){
                this.contexto = contexto;       }

        public void unsetEntityContext(){
                this.contexto=null;}
}
-------------------------------------------
<<CPERSONAHOME>>:

import java.util.Collection;
import java.rmi.RemoteException;
import javax.ejb.*;


public interface CEmpresaHome extends EJBHome {

        public CEmpresa create(int id_contempresa,String empresa,String
direccion,String codigoPostal,String telefono,String fax,String
ciudad,String pais,String web,String infoAdi,String departamento)throws
RemoteException,CreateException;
        public CEmpresa findByPrimaryKey(CEmpresaPK id_cita) throws
FinderException,RemoteException;
        public Collection findByEmpresa(String empresa) throws
FinderException,RemoteException;
        public Collection findByCiudad(String ciudad) throws
FinderException,RemoteException;
        public Collection findByPais(String pais) throws
FinderException,RemoteException;
        public Collection findByDepartamento(String departamento) throws
FinderException,RemoteException;

        }

-------------------
Thanks you.

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to