Objects are not automatically stored by reachability -- the car isn't inserted because it is attached to Customer. This *can* actually be done in the OTM if Car is a truly dependent object (otm-dependent attribute), but in the PB an object must be made explicitly persistent.

broker.store(ca);
broker.store(cu);

-Brian

On Feb 2, 2004, at 3:13 PM, Ralf Bode wrote:

Hi Brian,
now i got an "anonym" id
(very nice, so i now have "pure" javaBeans
no technicals in it :-)

i made
cu = new Custiomer();
ca = new Car();
cu.setCar(ca);
broker.store(cu);

now only a customer was in DB

i must add the "auto-*" in descriptor:
<reference-descriptor
  name="car"
  class-ref="de.ralle.Car"
  auto-retrive="true"
  auto-update="true"
  auto-delete="true">
 <foreignkey field-ref="carId"/>
</reference-descriptor>

now i have a car and a customer,
but custumer.carId is "null" in database...
of course carId is anonym too! ...

any idea? or am i to silly
and i must do pure sql ... as a penalty... ? :-)


in table customer is: CREATE TABLE CUSTOMER ( ID INT PRIMARY KEY AUTO_INCREMENT, CARID INT, FOREIGN KEY (CARID) REFERENCES CAR(ID) );

thanks!

 --- Ralf Bode <[EMAIL PROTECTED]> schrieb: > Thanks
Brian,

but do you mean with "anonymous" keys ?


now i have (in classes):
CUSTOMER
car: Car
carId: int

CAR:
id: int

(and the XML desc for it like in mail before)
am i with anon.keys able to "see" car-fk in
database-table CUSTOMER?
after:
broker.store(customer); ?

thanks again, and thanks for your patience.
greetings!



On the FK thing, if you do not use anonymous FK's
the ID's need to be
managed manually, as well as the references. I
tend
to recommend using
anonymous keys for FK relationships because it is
very easy to forget
this.

-Brian





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



__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de


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


__________________________________________________________________


Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de

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





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



Reply via email to