Hello Alan,

I'd think that usually you'd also set the address and the customer objects
manually for the new association, maybe you could just get the required Id's
from those references and set them manually for the association object, like
this:
{
...
        CustomerAddressLink cal = newCustomerAddressLink();
        cal.setCustomer(customer);
        cal.setCustomerId(customer.getId);

...

}

Sorry, in case this is just stating the obvious but I tend to overlook
obvious things *a lot*

Greetings,
Wulf



-----Urspr�ngliche Nachricht-----
Von: Olmanson, Alan [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 12. Dezember 2002 20:26
An: '[EMAIL PROTECTED]'
Betreff: Primary Keys that are also Foreign Keys


Hello, 

I our application we have link tables where we can not use MtoN
relationships because there is additional data in the table.  

We are using the PB and would like the foreign objects set into the Link
class to determine the key for the class.

So, for example we have a CustomerAddressLink, it has a customerId, an
addressId, a customer, and an address, along with other information.

If I create a new CustomerAddressLink and set the customer and address, the
object is not saved since the primary keys (customerId and addressId) have
not been set and are not auto-incremented.  With 0.9.7 I was able to set the
pk from the foreign objects in the beforeStore event, however with the
current version from CVS it ignores the new id when determining if it has a
valid pk.

Is there a way to do this?

Alan


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to