2 Replies Latest reply on Sep 9, 2002 6:50 PM by aaron_08544

    bug in CMR field persistence?

    aaron_08544

      Hi,

      I am trying to run a simple 1-N CMP2 example using Jboss 3.0.0 with MySQL using foreign key mapping.

      Things work fine if I set the foreign key CMR field of the many-side bean using the create method of the local interface of the one-side bean. But it fails to persist the CMR field if I use findByPrimaryKey method (of the local one-side bean interface).

      To keep it simple, assuming we have 1(Customer):N(Orders)
      The following code works fine (in torderBean):

      tcustomerLocalHome custhome = (tcustomerLocalHome) jndi.lookup("local/tcustomerBean");
      tcustomerLocal cust = custhome.create(email, "firstname", "lastname");
      setCustomer(cust);

      But fails under:

      tcustomerLocalHome custhome = (tcustomerLocalHome)
      tcustomerPK pk = new tcustomerPK();
      pk.email = email;
      tcustomerLocal cust = custhome.findByPrimaryKey(pk);
      System.out.println("linkOrderToCustomer: order "+ getOrderid() + cust.getEmail());
      setCustomer(cust);

      When I try to call getCustomer() the second method returns null while the first one returns a valid local object. Any ideas? Thanks in advance!

      -Aaron