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

    bug in CMR field persistence?

    Aaron Lee Newbie


      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");

      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());

      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!