Hi,

  I have 2 entity beans (CMP) Company and Departament
with a relationship 1 Company has N Departaments.
  To set a relationship on the client I want to do
this :

    Company company = ...
    Object ref = jndiContext.lookup("Departament");
    DepartamentHome departament_home =
(DepartamentHome) PortableRemoteObject.narrow (ref,
DepartamentHome.class);
    Departament departament =
departament_home.findByPrimaryKey(new
DepartamentPK(new Integer(1)));
    Integer i = company.getCodCompany();
    departament.setCompanyByID(new Integer(i));

 So I am calling a methon on the departament with the
primary key (Integer) of his related company.
  On DepartamentBean I have this :

        public abstract void setCompany(CompanyLocal company)
throws RemoteException;

        public void setCompanyByID(Integer Id) throws
RemoteException {
                try {
                        System.out.println("Set company by PK "+Id);
                        InitialContext ctx = new InitialContext();
                        CompanyLocalHome company_lh = (CompanyLocalHome)
ctx.lookup("java:comp/env/ejb/CompanyLocalHome");
                        CompanyLocal company_l =
company_lh.findByPrimaryKey(new CompanyPK(Id));
                        System.out.println("Company Name
:"+company_l.getCompanyName());
                        setCompany(company_l);
                } catch (Exception e) {
                        System.out.println(e.getMessage());
                }
        }

  When I execute the client code the company_l
variable is loaded correctly (I can see the value from
println statement with the right value) but the
relationship is not set on the database.
  
  What can be wrong ?

  Andre S.

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

_______________________________________________________________

Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to